Package net.hydromatic.morel.util
Class MapList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- net.hydromatic.morel.util.MapList<E>
-
- Type Parameters:
E- Element type
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,RandomAccess
public final class MapList<E> extends AbstractList<E> implements RandomAccess
Read-only list that generates elements between 0 andsize- 1 by applying a function.
-
-
Field Summary
Fields Modifier and Type Field Description private IntFunction<E>fnprivate intsize-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Modifier Constructor Description privateMapList(int size, IntFunction<E> fn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Eget(int index)static <E> MapList<E>of(int size, IntFunction<E> fn)Creates a MapList.intsize()-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Field Detail
-
size
private final int size
-
fn
private final IntFunction<E> fn
-
-
Constructor Detail
-
MapList
private MapList(int size, IntFunction<E> fn)
-
-
Method Detail
-
of
public static <E> MapList<E> of(int size, IntFunction<E> fn)
Creates a MapList.
-
get
public E get(int index)
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
-