java collection api

Enumerated Collection enumeration()

With legacy classes (JDK 1.0 DS) we use Enumeration. With collections framework classes we use Iterator or ListIterator. As such, with collection classes it is not possible to use Enumeration. To overcome this, the Collections class comes with enumeration() method. It returns collection class elements as an Enumeration. It is a good example on the …

Enumerated Collection enumeration() Read More »

Find Sublist Index with indexOfSubList()

The Collections class comes with many static methods (known as algorithms) of which two are used to know whether a few elements of a list are available in another list. If available, with these methods it can be known at what index they are available. The following is the signature of these two methods which …

Find Sublist Index with indexOfSubList() Read More »

Java Collections API Methods

A small confusion comes to a novice at this juncture between collection and collections. Both are very different. Collection is an interface and Collections is a class, both from java.util package. Collection is the root interface from which almost all data structures are derived, commonly known as collection framework. Collections class contains many static methods …

Java Collections API Methods Read More »

Collections Hierarchy Java

After knowing the meaning and purpose of Collections framework, let us know the basic interfaces, derived classes and their properties. Java data structures are nothing but subclasses of Collection and Map interfaces. Following hierarchy gives all the interfaces of Collections framework. Fig: Basic interfaces of collections framework Map and SortedMap form a separate hierarchy and …

Collections Hierarchy Java Read More »