Package io.microsphere.collection
Class ArrayEnumeration<E>
- java.lang.Object
-
- io.microsphere.collection.ArrayEnumeration<E>
-
- Type Parameters:
E- the type of elements in the array
- All Implemented Interfaces:
java.util.Enumeration<E>
public class ArrayEnumeration<E> extends java.lang.Object implements java.util.Enumeration<E>ArrayEnumerationis an implementation of enumeration based on an array, used to sequentially access elements in the array.This class implements the
Enumerationinterface and is suitable for scenarios where read-only sequential access to array elements is required.Example Usage
String[] data = {"one", "two", "three"}; ArrayEnumeration<String> enumeration = new ArrayEnumeration<>(data); while (enumeration.hasMoreElements()) { System.out.println(enumeration.nextElement()); }- Since:
- 1.0.0
- Author:
- Mercy
-
-
Constructor Summary
Constructors Constructor Description ArrayEnumeration(E[] elements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()booleanhasMoreElements()EnextElement()java.lang.StringtoString()
-
-
-
Constructor Detail
-
ArrayEnumeration
public ArrayEnumeration(E[] elements)
-
-
Method Detail
-
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElementsin interfacejava.util.Enumeration<E>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-