Tag: java.util.collections

Enumerated Collection enumeration()

September 3, 2011 · 1 min read
With **legacy classes** (JDK 1.0 DS) we use [Enumeration](http://way2java.com/collections/enumeration-interface/). With [collections framework](http://way2java.com/collections/java-collections-framework/) classes we use [Iterator](http://way2java.com/collections/iterator-interface/) or [ListIterator](http://way2java.com/collections/listiterator-interface/). As such, with collection classes it is not possible to use Enumeration. To overcome this, the [Collections class](http://way2java.com/collections/collections-api-methods/) comes with **enumeration()** method. It returns collection class elements as an Enumeration. It is a good example on the **interoperability** between legacy and collection classes.

Java Collections API Methods

August 11, 2011 · 6 min read
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](http://way2java.com/collections/java-interface-collection/) from which almost all data structures are derived, commonly known as [collection framework](http://way2java.com/collections/java-collections-framework/). **Collections** class contains many [static methods](http://way2java.com/oops-concepts/static-keyword-%e2%80%93-philosophy/) with which data structures manipulation becomes easier. I can say only word: Collections class is a boon (gift by the designers) to data structures which you too accept when you go through all the example codes given here under. I say boon because the lots of trouble you encountered with laborious coding of loops in C/C++ to manipulate DS elements is overcome with a simple method call. This is the best place to prove Java is simple language to practice.