Java TreeSet Class

TreeSet is class under Set interface of collection framework. It implements NavigableSet interface which extends SortedSet interface. Elements are ordered by a Comparator which is provided at set creation time or by natural ordering. It maintains the ascending sorting order. TreeSet is not synchronized so if multiple threads accessing it concurrently and any one modifies set entry then … Read more

Java SortedSet Interface

SortedSet interface extends Set interface in collection framework of java. As name suggest, It provides total ordering on elements of Set. Set elements will be ordered using their natural ordering or using a comparator interface. All the elements entries of SortedSet must implement Comparable interface. All the elements of SortedSet must be comparable. So e1.compareTo(e2) … Read more

Java ArrayDeque Class

ArrayDeque is one of the collection framework member which implements Deque, Cloneable and Serializable interfaces. ArrayDeque provides Resizable-array implementation so it has no capacity restrictions and it will grow as per requirement. In the absence of external synchronization, they are not thread safe. So they do not allow multiple threads to access it concurrently. Also … Read more

Java Queue Interface

If you look at collection hierarchy, Queue extends collection interface. Main purpose of collection is to hold the elements prior to processing. Queue interface provides some additional operations like insertion, inspection and extraction besides collection interface operations. All these three operations exist in 2 different forms. One return special value(null or false depending on the operation) … Read more