Shriansh Kumar has Published 173 Articles

How to Fix java.lang.ClassCastException in TreeSet By Using Custom Comparator in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 16:22:44

95 Views

The TreeSet is a generic class of Java Collection Framework that implements the SortedSet Interface. It stores the elements of the set in a tree structure. Furthermore, all the elements are stored in a sorted manner and they must be mutually comparable if we are attempting to add custom class ... Read More

How to Get All the Values of the LinkedHashMap in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 16:01:51

231 Views

LinkedHashMap is a generic class of Java Collection Framework that implements Map Interface. As the name suggests, it is a sub-class of the HashMap class and uses a doubly LinkedList to store the entries in insertion order. It maintains Key-Value pair of entries. The Key is an object that is ... Read More

How to Get a Value From LinkedHashMap by Index in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 15:59:42

410 Views

LinkedHashMap is a generic class of Java Collection Framework that implements Map Interface. As the name suggests, it is a sub-class of the HashMap class and uses a doubly LinkedList to store the entries in insertion order. However, LinkedHashMap does not do any kind of indexing to store the entries, ... Read More

How to Find the Minimum or Maximum Element from LinkedHashSet in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 15:57:10

66 Views

LinkedHashSet is a class of Java Collection Framework that implements the Set interface and extends the HashSet class. It is a linked list type of collection class. It stores and returns the objects in the order in which they were inserted. Finding maximum and minimum elements from a LinkedHashSet collection ... Read More

How to find the Entry with largest Value in a Java Map

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 15:51:32

958 Views

In Java, Map is an object that stores its element in key-value pairs. The Key is an object that is used to fetch and receive value associated with it. The keys must be unique, but the values associated with them may be duplicated depending on the type of Map class ... Read More

How to Find Prime and Palindrome Numbers using Multi-Threading in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 15:37:02

381 Views

Multithreading is a feature of the Java programming language that allows us to perform multiple operations simultaneously. In it, the operation gets divided into multiple smaller parts called a thread. Each thread performs one independent task without affecting the other thread's performance. The main benefit of multithreading is the optimal ... Read More

How to find Max Memory, Free Memory and Total Memory in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 15:35:17

719 Views

Memory management is an important aspect of any Java application. Having the knowledge of how much memory is available, how much is used and how much is free may help you to optimize your code and avoid performance issues or memory leaks. This article aims to help in finding max ... Read More

How to find duplicate elements in a Stream in Java

Shriansh Kumar

Shriansh Kumar

Updated on 19-Jul-2023 19:06:38

7K+ Views

Finding duplicate elements in a stream of data is one of the common questions that is asked in Java interviews and even in the exams of many students. Java provides several ways to find duplicate elements, we will focus mainly on two ways: the first one is by using Set ... Read More

How to Find User Defined Objects From LinkedHashSet in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 19-Jul-2023 18:49:36

150 Views

LinkedHashSet is a class of Java Collection Framework that implements the Set interface and extends the HashSet class. It is a linked list type of collection class. It stores and returns the objects in the order in which they were inserted, therefore it does not allow duplicate objects. In this ... Read More

How to Find the Number of Arguments Provided at Runtime in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 19-Jul-2023 18:40:22

437 Views

In Java, one way of passing arguments at runtime is by using the command line or terminal. While retrieving those values of command line arguments, we may need to find the number of arguments provided by the user at runtime which is possible with the help of length property. This ... Read More

Previous 1 ... 7 8 9 10 11 ... 18 Next
Advertisements