How to create and use Hashtable?
This post explains implementation of Hashtable. We can find this class in java.util. Hashtable maps keys to values , these keys and values can be any non null objects. Hashtable uses hashing function algorithm so the object which we use for [...]
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 [...]
How to use Generics in java?
Generics can be used to create the collection with holding the objects of certain type. This eliminates the need of unnecessary casting of the object while retrieving from the collection.
Now lets look at the list containing integer objects [...]
