How HashMap works in java

How HashMap works in Java

How HashMap works in Java How HashMap works in Java or do you know Hashmap in java is one of the most asked interview question in java. As it checks your knowledge about the collection as HashMap is one of the mostly needed and used Collection [...]

TreeSet in Java

How to use TreeSet in Java : TreeSet in java is a class which implements Set interface. Let see few characteristics of TreeSet in java before taking look at java treeset example. TreeSet in java 1. TreeSet in java guarantees sorted set of elements [...]

How to use HashSet in Java?

HashSet : HashSet implements Set interface. To store the values it uses Hashtable internally which uses hashing mechanism. Because of Hashing there are two advantages, first because it is used to find duplicates using the key and second is [...]

Collections when and what to use

Lets see we can use which collections according to their characteristics : ArrayList : As ArraylList implements List interface. ArrayList allows random access and fast iteration. So ArrayList can be used when 1. We need random access to the [...]

ArrayList speed optimization.

Lets see how we can increase the speed while processing the ArrayList. The default size for a Java ArrayList class at the initial stage is 10. When an ArrayList operation reaches its maximum capacity which is 10, it increases its capacity by [...]
Java Programming Tips and How To

How to reverse all elements in vector and ArrayList?

You may have following questions like : How to reverse the order of elements in java Vector ? How to reverse the order of elements in java ArrayList? You can easily reverse the order of elements in Vector and ArrayList using Collections class. java.util.Collections [...]

What are the differences between HashMap and Hashtable?

Lets see what are the differences we can see in HashMap and Hashtable. 1. Synchronization : Hashtables are synchronized , it means at one point of time only one thread can modify a Hashtable. i.e any thread before performing an update on a hashtable [...]
Java Programming Tips and How To

How to sort arraylist containing objects?

You must be having questions mentioned below: how to sort arraylist having objects? How to sort arraylist contianing the objects? Sorting an arraylist contianing the objects. Sorting an arraylist of objects. How to sort a custom made class using [...]