Package io.microsphere.collection
Class EnumerationUtils
- java.lang.Object
-
- io.microsphere.collection.EnumerationUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> java.util.Enumeration<E>
of(E... elements)
Creates anEnumeration
from the provided elements.static <E> java.util.Enumeration<E>
ofEnumeration(E... elements)
Creates anEnumeration
from the provided elements array.
-
-
-
Method Detail
-
of
@Nonnull public static <E> java.util.Enumeration<E> of(E... elements)
Creates anEnumeration
from the provided elements.Internally, this method delegates to
ofEnumeration(Object[])
to create a new enumeration based on the given array of elements.Example Usage
Enumeration<String> en = EnumerationUtils.of("one", "two", "three"); while (en.hasMoreElements()) { System.out.println(en.nextElement()); }
- Type Parameters:
E
- the type of the elements- Parameters:
elements
- the array of elements to include in the enumeration- Returns:
- a non-null
Enumeration
instance containing the specified elements
-
ofEnumeration
public static <E> java.util.Enumeration<E> ofEnumeration(E... elements)
Creates anEnumeration
from the provided elements array.This method constructs a new
ArrayEnumeration
instance backed by the given array, allowing sequential read-only access to the array elements.Example Usage
Enumeration<String> en = EnumerationUtils.ofEnumeration("apple", "banana", "cherry"); while (en.hasMoreElements()) { System.out.println(en.nextElement()); }
- Type Parameters:
E
- the type of the elements- Parameters:
elements
- the array of elements to include in the enumeration- Returns:
- a non-null
Enumeration
instance containing the specified elements
-
-