Enumeration - Definition - Wrapper classes

Q.  Which defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements?
- Published on 20 Jul 15

a. Bitset
b. Vector
c. Stack
d. Enumeration

ANSWER: Enumeration
 

    Discussion

  • Nirja Shah   -Posted on 15 Dec 15
    Enumeration :
    - This interface isn't itself a data structure, but it is very important within the context of other data structures.
    - It defines a means to retrieve successive elements from a data structure.
    - For example, Enumeration defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements.

    BitSet
    - This class implements a group of bits or flags that can be set and cleared individually.
    - It is very useful in cases where you need to keep up with a set of Boolean values; you just assign a bit to each value and set or clear it as appropriate.

    Vector
    - This class is similar to a traditional Java array, except that it can grow as necessary to accommodate new elements.
    - Like an array, the elements of a Vector object can be accessed via an index into the vector.
    - One of the best part about using the Vector class is that you don't have to worry about setting it to a specific size upon creation; it shrinks and grows automatically when necessary.

    Stack
    - It implements a last-in-first-out (LIFO) stack of elements.
    - It can be thought of as a vertical stack of objects; when you add a new element, it gets stacked on top of the others.
    - When you pull an element off the stack, it comes off the top. In other words, the last element you added to the stack is the first one to come back off.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)