public class Enumerate
extends java.lang.Object
Iterable.
import java.util.ArrayList; import java.util.List; import static com.github.fracpete.javautils.Enumerate.enumerate; Listlist = new ArrayList<>(Arrays.asList("a", "b", "c")); for (Enumerated e: enumerate(list)) System.out.println(e.index + ": " + e.value);
EnumerateExamples| Constructor and Description |
|---|
Enumerate() |
| Modifier and Type | Method and Description |
|---|---|
static <E> java.lang.Iterable<Enumerated<E>> |
enumerate(E[] array)
Returns an Iterable wrapper around an array that combines index
(starting at 0 with step 1) and value of the array item in the returned
container object (
Enumeration). |
static <E> java.lang.Iterable<Enumerated<E>> |
enumerate(E[] array,
int start)
Returns an Iterable wrapper around an array that combines index
(starting at "start" with step 1) and value of the array item in the returned
container object (
Enumeration). |
static <E> java.lang.Iterable<Enumerated<E>> |
enumerate(E[] array,
int start,
int step)
Returns an Iterable wrapper around an array that combines index
(starting at "start" with step size "step") and value of the array item in the returned
container object (
Enumeration). |
static <E> java.lang.Iterable<Enumerated<E>> |
enumerate(java.lang.Iterable<E> iterable)
Returns an Iterable wrapper around an Iterable that combines index
(starting at 0 with step 1) and value of the Iterable in the returned
container object (
Enumeration). |
static <E> java.lang.Iterable<Enumerated<E>> |
enumerate(java.lang.Iterable<E> iterable,
int start)
Returns an Iterable wrapper around an Iterable that combines index
(starting at "start" with step 1) and value of the Iterable in the returned
container object (
Enumeration). |
static <E> java.lang.Iterable<Enumerated<E>> |
enumerate(java.lang.Iterable<E> iterable,
int start,
int step)
Returns an Iterable wrapper around an Iterable that combines index
(starting at "start" with step size "step") and value of the Iterable in the returned
container object (
Enumeration). |
static <E> java.util.Iterator<Enumerated<E>> |
enumerate(java.util.Iterator<E> iterable)
Returns an Iterable wrapper around an Iterator that combines index
(starting at 0 with step 1) and value of the Iterable in the returned
container object (
Enumeration). |
static <E> java.util.Iterator<Enumerated<E>> |
enumerate(java.util.Iterator<E> iterable,
int start)
Returns an Iterable wrapper around an Iterator that combines index
(starting at "start" with step 1) and value of the Iterable in the returned
container object (
Enumeration). |
static <E> java.util.Iterator<Enumerated<E>> |
enumerate(java.util.Iterator<E> iterable,
int start,
int step)
Returns an Iterable wrapper around an Iterator that combines index
(starting at "start" with step size "step") and value of the Iterable in the returned
container object (
Enumeration). |
public static <E> java.lang.Iterable<Enumerated<E>> enumerate(java.lang.Iterable<E> iterable)
Enumeration).E - the type of the iterable's objectsiterable - the iterable to wrappublic static <E> java.lang.Iterable<Enumerated<E>> enumerate(java.lang.Iterable<E> iterable, int start)
Enumeration).E - the type of the iterable's objectsiterable - the iterable to wrapstart - the starting indexpublic static <E> java.lang.Iterable<Enumerated<E>> enumerate(java.lang.Iterable<E> iterable, int start, int step)
Enumeration).E - the type of the iterable's objectsiterable - the iterable to wrapstart - the starting indexstep - the step sizepublic static <E> java.util.Iterator<Enumerated<E>> enumerate(java.util.Iterator<E> iterable)
Enumeration).E - the type of the Iterator's objectsiterable - the Iterator to wrappublic static <E> java.util.Iterator<Enumerated<E>> enumerate(java.util.Iterator<E> iterable, int start)
Enumeration).E - the type of the Iterator's objectsiterable - the Iterator to wrapstart - the starting indexpublic static <E> java.util.Iterator<Enumerated<E>> enumerate(java.util.Iterator<E> iterable, int start, int step)
Enumeration).E - the type of the Iterator's objectsiterable - the Iterator to wrapstart - the starting indexstep - the step sizepublic static <E> java.lang.Iterable<Enumerated<E>> enumerate(E[] array)
Enumeration).E - the type of the Iterator's objectsarray - the array to wrappublic static <E> java.lang.Iterable<Enumerated<E>> enumerate(E[] array, int start)
Enumeration).E - the type of the Iterator's objectsarray - the Iterator to wrapstart - the starting indexpublic static <E> java.lang.Iterable<Enumerated<E>> enumerate(E[] array, int start, int step)
Enumeration).E - the type of the Iterator's objectsarray - the array to wrapstart - the starting indexstep - the step sizeCopyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.