StackTips

Java Collection APIs

The Collections framework in Java defines numerous different data structures in which you can store, group, and retrieve objects.

17 Lessons JavaBeginner Level

Java Collections API is a set of interfaces and implementations included in the Java standard library. The collections framework in Java defines different data structures in which you can store, group, and retrieve objects. 

This course is a getter starter guide into the Java collection framework!
  • Introduction to Java Collections

    Java Collections API is a set of interfaces and implementations included in the Java standard library.

  • ArrayList in Java

    ArrayList is similar to a regular array except that the size is dynamically adjusted as the number of items in the collection changes.

  • LinkedList in Java

    LinkedList uses a doubly linked list to store elements and it implements both the List and Queue interfaces.

  • CopyOnWriteArrayList in Java

    The CopyOnWriteArrayList is the thread-safe implementation of the List interface. It is very useful when we want to iterate over a list in a thread-safe way without explicit synchronization.

  • Vector in Java

    Vector is a legacy implementation of a list added to Java since version 1.0. It was later moved to the Java Collections Framework and retrofitted to implement the `List` interface.

  • Stack in Java

    Stack extends Vector with five operations that allow a vector to be treated as a stack. It supports last-in, first-out (LIFO) operations.

  • HashSet in Java

    The `HashSet` is a collection that uses a hash table for storage. Elements are stored by hashing and as a result, it only supports unique elements.

  • LinkedHashSet in Java

    A LinkedHashSet combines the behaviour of both a HashTable and a LinkedList. The elements are unique, while also maintaining the insertion order.

  • TreeSet in Java

    A TreeSet in Java is a collection that implements the NavigableSet interface and uses a TreeMap internally to store elements.

  • PriorityQueue in Java

    PriorityQueue is a type of queue that stores elements in a way such that the element with the highest priority is always at the front of the queue

  • DelayQueue in Java

    DelayQueue in Java is a specialized implementation of a blocking queue that supports delayed elements

  • ArrayDeque in Java

    The ArrayDeque is a resizable array implementation of the `Deque` interface. It supports adding and removing elements from both ends of the deque (double-ended queue) efficiently.

  • HashMap in Java

    A HashMap uses key-value pairs to insert and access items.

  • LinkedHashMap in Java

    The LinkedHashMap works very similar to HashMap but it maintains a doubly-linked list to maintain the insertion order of elements.

  • IdentityHashMap in Java

    The IdentityHashMap implements the Map interface. It compares the references address of the keys.

  • TreeMap in Java

    The TreeMap implements the NavigableMap interface and the NavigableMap interface extends the SortedMap. It stores the items in a sorted order.

  • Hashtable in Java

    The Hashtable is a legacy implementation of HashMap. It provides a key-value store where the keys are hashed. HashMap performs better than Hashtable.