List interface which extends collection
The `Collection` interface in Java is extended by several subinterfaces that specialize in various types of collections. These subinterfaces define additional operations that are specific to the collection types they represent. Here are the primary interfaces that extend the `Collection` interface:

Table of Contents
1. List
- Represents an ordered collection (also known as a sequence).
- Allows duplicate elements.
- Provides positional access and insertion of elements. Â Â – Common implementations: `ArrayList`, `LinkedList`, `Vector`, `Stack`.
Example
```java
List<String> list = new ArrayList<>();
list.add("Apple");
list.add("Banana");
list.add("Cherry");
```
2. Set
- Represents a collection that does not allow duplicate elements.
- The order of elements is not guaranteed.
- Common implementations: `HashSet`, `LinkedHashSet`, `TreeSet`.
Example
```java
Set<String> set = new HashSet<>();
set.add("Apple");
set.add("Banana");
set.add("Cherry");
```
3. Queue
- Represents a collection designed for holding elements prior to processing.
- Typically, but not necessarily, orders elements in a FIFO (first-in-first-out) manner. Â Â – Common implementations: `LinkedList`, `PriorityQueue`, `ArrayDeque`.
Example
```java
Queue<String> queue = new LinkedList<>();
queue.add("Apple");
queue.add("Banana");
queue.add("Cherry");
```
4. Deque (Double-Ended Queue)
- Extends the `Queue` interface to support element insertion and removal at both ends.
- Common implementations: `ArrayDeque`, `LinkedList`.
Example
```java
Deque<String> deque = new ArrayDeque<>();
deque.addFirst("Apple");
deque.addLast("Banana");
deque.addFirst("Cherry");
```
5. SortedSet
- Extends the `Set` interface for sets that maintain their elements in a sorted order.
- The order is determined by either the natural ordering of the elements or a specified comparator.
- Common implementations: `TreeSet`.
Example
```java
SortedSet<String> sortedSet = new TreeSet<>();
sortedSet.add("Apple");
sortedSet.add("Banana");
sortedSet.add("Cherry");
```
6. NavigableSet
- Extends `SortedSet` to provide navigation methods such as lower, floor, ceiling, and higher.
- Common implementations: `TreeSet`.
Example
```java
NavigableSet<String> navigableSet = new TreeSet<>();
navigableSet.add("Apple");
navigableSet.add("Banana");
navigableSet.add("Cherry");
```
Diagram of the Collection Hierarchy:
Diagram
```
Collection
│
├── List
│ ├── ArrayList
│ ├── LinkedList
│ ├── Vector
│ └── Stack
│
├── Set
│ ├── HashSet
│ ├── LinkedHashSet
│ ├── TreeSet
│ └── SortedSet
│ └── NavigableSet
│
├── Queue
│ ├── LinkedList
│ ├── PriorityQueue
│ └── Deque
│ ├── ArrayDeque
│ └── LinkedList
```
Summary:
- List: Ordered collection with duplicates allowed.
- Set: Unordered collection with no duplicates.
- Queue: Collection designed for holding elements prior to processing.
- Deque: Double-ended queue supporting insertion and removal at both ends.
- SortedSet: Set that maintains elements in a sorted order.
- NavigableSet: SortedSet with additional navigation methods.
These interfaces extend the `Collection` interface to provide more specific behaviors tailored to different types of collections, enabling developers to choose the appropriate collection type for their needs.