devxlogo

Understand the Main Interfaces of the Collections API

JDK 1.2 includes a new library of data structures called Collections. The Collections API contains object collection data structures. The Collection interface is the root interface for all the Collection classes. It basically represents a group of object called “elements.” If you want to store a collection of unique elements and do not care about the order in which they are stored, use a Set. To store a collection of unique ordered elements, use a SortedSet. To store a collection of ordered elements, (not necessarily unique), use a List. To store an unordered collection of elements that are retrievable by key, use a Map. Finally, to store an ordered collection of elements that are retrievable by key, use SortedMap. The following data structures of JDK 1.1 have been replaced in JDK 1.2: Vector is replaced with List, and Hashtable is replaced with Map.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Seven Service Boundary Mistakes That Create Technical Debt

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.