Java Data Structure Definition #2

Java Data Structure #2

So from the last article I already explain to you what is a Data Structure in general and what is a Java Data Structure. Just like I promised in that craftingez6-coding post, within this 2 post I’ll explain to you the Java Data Structure (interface and classes) one by one.

Enumeration

Enumeration is a type of Interface, enumeration itself is not actually a data structure, but it surely is very very important to the context of the other data structures. The enumeration interface means to retrieve a successive elements from a data structure.
In example,
Enumeration could define a method called nextElement. And that method is used to get the next element inside the data structure that contains more than 1 elements.
 

Bitset

BitSet is a type of class that implements a group of, guess what? “bits” or flags that you / the person can set and clear individually. This type of class is very useful in some cases where you need to keep up to code a set of Boolean values; you could just assign a bit to each value then set or clear it as appropriate

Vector

Vector class actually have similarities with a traditional Java array. Well except that Vector class can grow as necessary to accommodate new elements. 
 
Just like an array, the elements that is inside the Vector object can be accessed via index into the vector. You know what, the nice thing about Vector is that you doesn’t have to worry anymore about setting the elements into a specific size upon creation, it’ll actually grows and shrinks automatically when it is necessary.

The Stack

Stack class in java implements the last-in-first-out (LIFO) stack of elements. Imagine this illustration, you can imagine stack literally as a vertically stacked objects on top of each other. 
 
When you add new objects, it will get stacked on top of the others (the last object).
 
Then, when you pull an element off from that stacked objects. The last object will be the first object to come back off again.

The Dictionary

This dictionary doesn’t literally mean a dictionary, but it is rather an abstract class that defines data structure for mapping key to values. This kind class is useful whenever you want to access data via particular key rather than using an integer index.
Since the dictionary class is abstract, the class only provides the framework for a key mapped data. Rather than some specific implementation.