Abstractions and Implementations

Learn about the collections of interfaces and classes used for data structures in Java.

Interfaces and classes in Java

Data structures are one of the most fundamental and essential building blocks of computer science. Any data structure can be divided into two distinct parts—interfaces and implementation. As we progress, we’ll have an elaborate discussion on these features.

We’ve seen many examples of arrays, which is the first step to understanding data structures. We now know data structures can facilitate sorting, organizing, inserting, updating, removing, and displaying our data.

Efficiently sorting and organizing data plays a massive role in constructing our data structure. Besides, we need to remember one key aspect of computation: how much time the program takes and how much memory or space it requires. In this context, algorithms play a vital role. An efficient algorithm to handle data structure is always needed, so we’ll also look at time complexity and memory allocation.

The data structure, as a whole, is a vast topic: every programming language has its own way of using the basic concepts of data structure. We’ll limit our main discussion to C, C++, and Java, though we’ll talk about Python, Dart, PHP, and C# as well.

To get an idea of how complex entities like data structures are constructed, we should look into the Collection interface first. In Java, the Collection interface is divided into subinterface branches:

  • BeanContext

  • BeanContextServices

  • BlockingDeque

  • BlockingQueue

  • Deque

  • List

  • NavigableSet

  • Queue

  • Set

  • SortedSet

  • TransferQueue

Let’s first talk about the List interface. The AbstractList class implements the List interface. Next, we have three more classes—ArrayList, Vector, and AbstractSequentialList—which extend the AbstractList class. Finally, the LinkedList class extends the properties and methods of the AbstractSequentialList class. However, this list is incomplete.

Actually, there are many implementing classes:

  • AbstractCollection

  • AbstractList

  • AbstractQueue

  • AbstractSequentialList

  • AbstractSet

  • ArrayBlockingQueue

  • ArrayDeque

  • ArrayList

  • AttributeList

  • BeanContextServicesSupport

  • BeanContextSupport

  • ConcurrentLinkedDeque

  • ConcurrentLinkedQueue

  • ConcurrentSkipListSet

  • CopyOnWriteArrayList

  • CopyOnWriteArraySet

  • DelayQueue

  • EnumSet

  • HashSet

  • JobStateReasons

  • LinkedBlockingDeque

  • LinkedBlockingQueue

  • LinkedHashSet

  • LinkedList

  • LinkedTransferQueue

  • PriorityBlockingQueue

  • PriorityQueue

  • RoleList

  • RoleUnresolvedList

  • Stack

  • SynchronousQueue

  • TreeSet

  • Vector

Java Collections Framework

This Collection interface has a superinterface: Iterable.

Various interfaces and implementations include Set, SortedSet, List, Queue, Deque, Map, and SortedMap. Core collection interfaces are the foundation of the Java Collections Framework. In C or C++, it’s thought of differently. Other languages have their own constructs.