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>
ArrayEnumeration
is an implementation of enumeration based on an array, used to sequentially access elements in the array.This class implements the
Enumeration
interface 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 boolean
equals(java.lang.Object o)
int
hashCode()
boolean
hasMoreElements()
E
nextElement()
java.lang.String
toString()
-
-
-
Constructor Detail
-
ArrayEnumeration
public ArrayEnumeration(E[] elements)
-
-
Method Detail
-
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElements
in interfacejava.util.Enumeration<E>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-