Skip to content

Tag Archives: Java-Collections

The HashSet class implements the Set interface, backed by a hash table which is actually a HashMap instance. No guarantee is made as to the… Read More
In this article, we are going to see how to iterate through a List. In Java, a List is an interface of the Collection framework.… Read More
LinkedBlockingQueue API is an optionally-bounded queue based on linked nodes. It orders the elements in FIFO(First In First Out) order. The head of this queue… Read More
Map Interface is present in Java.util package, which provides mainly three methods KeySet(),entrySet() and values(). These methods are used to retrieve the keys of the… Read More
Enumerations serve the purpose of representing a group of named constants in a programming language. Enums are used when we know all possible values at… Read More
Double hashing is a technique in an open addressing scheme. and there is the ordinary hash function. In an open addressing scheme, the actual hash… Read More
Creating Thread Safe ConcurrentHashSet is not possible before JDK 8 because of the java.util.concurrent package does not have a class called ConcurrentHashSet, but starting with… Read More
Unlike the List classes like ArrayList or a LinkedList, the TreeSet class does not allow accessing elements using the index. There are no direct methods… Read More
Collection.forEach() and are used for iterating over the collections, there is no such major difference between the two, as both of them give the… Read More
A list is an ordered sequence of elements stored together to form a collection. A list can contain duplicate as well as null entries. A… Read More
PriorityBlockingQueue is an unbounded blocking queue that uses the same ordering rules as class PriorityQueue and supplies blocking retrieval operations. The “blocking” part of the… Read More
TreeSet is mainly an implementation of SortedSet in java where duplication is not allowed and objects are stored in sorted and ascending order. Some important… Read More
To implement a hash table, we should use the hash table class, which will map keys to the values. The key or values of the… Read More
The TreeMap is used to implement Map interface and NavigableMap along with the AbstractMap class in java. The map is sorted by the natural ordering… Read More
HashSet extends AbstractSet and implements the Set interface. It creates a collection that uses a hash table for storage. The class does not guarantee the… Read More