Class Nil<E>
java.lang.Object
com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractList<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractLinkedList<E>
com.github.andrewoma.dexx.collection.ConsList<E>
com.github.andrewoma.dexx.collection.Nil<E>
- All Implemented Interfaces:
Iterable<E>, LinkedList<E>, List<E>, Traversable<E>, Iterable<E>
Nil is the empty list
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a list with the specified element appended to the bottom of the list.drop(int number) Returns a list containing all elements in this list, excluding the firstnumberof elements.first()Returns first element in the list ornullif the list is empty.get(int i) Returns the element at the specified index in this list (zero-based).booleanisEmpty()Returns true if this collection is empty.last()Returns last element in the list ornullif the list is empty.range(int from, boolean fromInclusive, int to, boolean toInclusive) Returns a list containing a contiguous range of elements from this list.Returns a list with the element set to the value specified at the index (zero-based).tail()Returns a list containing all elements in the list, excluding the first element.take(int number) Returns a list containing the firstnumberof elements from this list.Methods inherited from class AbstractList
asList, equals, hashCode, indexOf, lastIndexOfMethods inherited from class AbstractIterable
forEachMethods inherited from class AbstractTraversable
makeString, makeString, size, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toStringMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface List
asList, indexOf, lastIndexOfMethods inherited from interface Traversable
forEach, makeString, makeString, size, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
Constructor Details
-
Nil
Nil()
-
-
Method Details
-
isEmpty
public boolean isEmpty()Description copied from interface:TraversableReturns true if this collection is empty.- Specified by:
isEmptyin interfaceTraversable<E>- Overrides:
isEmptyin classAbstractTraversable<E>
-
first
-
tail
Description copied from interface:ListReturns a list containing all elements in the list, excluding the first element. An empty list is returned if the list is empty. -
set
Description copied from interface:ListReturns a list with the element set to the value specified at the index (zero-based). -
append
Description copied from interface:ListReturns a list with the specified element appended to the bottom of the list. -
drop
Description copied from interface:ListReturns a list containing all elements in this list, excluding the firstnumberof elements. -
take
-
range
@NotNull public @NotNull ConsList<E> range(int from, boolean fromInclusive, int to, boolean toInclusive) Description copied from interface:ListReturns a list containing a contiguous range of elements from this list.- Specified by:
rangein interfaceLinkedList<E>- Specified by:
rangein interfaceList<E>- Specified by:
rangein classConsList<E>- Parameters:
from- starting index for the range (zero-based)fromInclusive- if true, the element at thefromindex will be includedto- end index for the range (zero-based)toInclusive- if true, the element at thetoindex will be included
-
get
-
last
-