Advanced Java Tutorial


Total available pages count: 55
Subject - Java Technologies

Queue Interface

The interface maintains the FIFO order of data structure.it defined as an ordered list that used to hold an element that is about to be processed. PriorityQueue, Dequeue & ArrayDeque can be implemented in the Queue interface.

Queue<String> q1= new PriortyQueue();
Queue<String> q2= new ArrayDeque();

 

Set interface

The Set interface available in java.util package, it extends the collection interface. The set represents an unordered group of elements that don’t allow to store the duplicate items. A set can store null values if implemented by HashSet, LinkedHashSet & TreeSet.

Set<data-type> s1 = new HashSet<data-type>();
Set<data-type> s2 = new LinkedHashSet<data-type>();
Set<data-type> s3 = new treeSet<data-type>();

 

HashSet

HashSet implements Set interface. HashSet represents the collection that uses the hash table for storage.  hashing used to store data into HashSet. it neglect duplicate item & contains unique items.

LinkedHashSet

The LinkedHashSet represents the implementation of the set interface. LinkedHashSet extends the HashSet class & implement the Set interface. It contains unique items & maintains the insertion & permit null element.



Comments