Java (Page 2/21)

How to sort an ArrayList in java

Let’s learn how to sort an ArrayList in java. How to sort an ArrayList in java To sort an ArrayList of String type we are…

Read More

Difference between hashset and treeset in java

Let’s learn difference between hashset and treeset in java. Difference between hashset and treeset in java HashSet TreeSet stores object in random order. sorted according…

Read More

How to sort treeset in descending order in java

Let’s learn how to sort treeset in descending order in java. How to sort treeset in descending order in java In this post lets sort…

Read More

iterate treemap in java

Let’s learn iterate treemap in java. iterate treemap in java We cannot iterate TreeMap. Since TreeMap is not a collection. To iterate use entrySet() method…

Read More

Java treemap sort by value

Let’s learn java treemap sort by value. Java treemap sort by value To sort a treemap by value we have to build some logic using…

Read More

Java treemap comparator() method example

Let’s learn java treemap comparator() method example. Java treemap comparator() method example TreeMap comparator() method returns the comparator used to order the keys in this…

Read More

Difference between for and for each loop in java

Let’s learn difference between for and for each loop in java. Difference between for and for each loop in java Here’s the difference between for…

Read More

How to sort an array without using sort method in java

Let’s learn how to sort an array without using sort method in java. How to sort an array without using sort method in java In…

Read More

Why string is immutable in java

Let’s learn why string is immutable in java. Why string is immutable in java String is immutable in java because String objects are cached in…

Read More

Scope and lifetime of variables in java

Let’s learn scope and lifetime of variables in java. Scope and lifetime of variables in java I have discussed variables in java in my earlier…

Read More