Package net.hydromatic.morel.util
Class ConsList<E>
java.lang.Object
net.hydromatic.morel.util.AbstractImmutableList<E>
net.hydromatic.morel.util.ConsList<E>
- Type Parameters:
E- Element type
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>
List that consists of a head element and an immutable non-empty list.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.hydromatic.morel.util.AbstractImmutableList
add, add, addAll, addAll, clear, contains, containsAll, isEmpty, remove, remove, removeAll, retainAll, set, subListMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Field Details
-
first
-
rest
-
-
Constructor Details
-
ConsList
-
-
Method Details
-
of
Creates a ConsList. It consists of an element pre-pended to another list. If the other list is mutable, creates an immutable copy. -
get
-
size
public int size() -
hashCode
public int hashCode() -
equals
-
toString
-
toList
- Specified by:
toListin classAbstractImmutableList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>- Overrides:
listIteratorin classAbstractImmutableList<E>
-
iterator
-
listIterator
- Specified by:
listIteratorin interfaceList<E>- Overrides:
listIteratorin classAbstractImmutableList<E>
-
toArray
-
toArray
-
indexOf
-
lastIndexOf
-