• September 1, 2014
  • Core Java
  • Comments Off on Collection classes in java

Collection classes in java

Collection classes:

Collection classes are the concrete implementations of the collection interfaces.

 Collection classes are given below:

1. HashSet: HashSet extends AbstractSet and implements the Set interface. It not maintains any order for its elements. It uses hash table for storage.

2. LinkedHashSet: LinkedHashSet extends HashSet and implements the Set interface. It maintains insertion order for its elements.

3. TreeSet: TreeSet extends AbstractSet and implements the NavigableSet interface. It maintains ascending order for its elements i.e. elements will be in sorted form.

4. ArrayList: ArrayList class extends AbstractList and implements the List interface. It uses dynamic arrays for storing elements. It maintains insertion order. ArrayList can contain duplicate elements. It is not synchronized.

5. LinkedList: LinkedList class extends AbstractSequentialList and implements the List and Deque interface. It uses linked list data structure to store elements. It can contain duplicate elements. It is not synchronized.

6. HashMap: HashMap extends AbstractMap class and implements the Map interface. It contains the elements in key-value pair form. It not maintains any order for its elements. It not allowed duplicate key. A HashMap can have only one null key and multiple null values.

7. LinkedHashMap: LinkedHashMap extends HashMap class and implements the Map interface. It contains the elements in key-value pair form. It maintains insertion order for its elements. It not allowed duplicate key. A LinkedHashMap can have only one null key and multiple null values.

8. TreeMap: TreeMap extends AbstractMap class and implements the NavigableMap interface. It contains the elements in key-value pair form. It maintains ascending order for its elements. It not allowed duplicate key. A TreeMap can have only one null key but can have multiple null values.
 
Next Topic: HashSet in java with example.
Previous Topic: Enumeration interface in java with example.

Related Topics:

Collection framework in java.
Collection interfaces in java.
Collection interface in java with example.
Set interface in java with example.
SortedSet interface in java with example.
List interface in java with example.
Map interface in java with example.
Daemon thread in java in java with example.
SortedMap interface in java with example.
Queue interface in java with example.
Deque interface in java with example.
Enumeration interface in java with example.
Collection classes in java with example.
HashSet in java with example.
LinkedHashSet in java with example.
TreeSet in java with example.
ArrayList in java with example.
LinkedList in java with example.
HashMap in java with example.
LinkedHashMap in java with example.
TreeMap in java with example.
PriorityQueue in java with example.
ArrayDeque in java with example.
Abstract classes in collection framework in java with example.
Sorting in java with example.
Comparable interface in java with example.
Comparator interface in java with example.
Properties class in java with example.
Hashtable in java with example.
ListIterator interface in java with example.

 


Comments are closed.