A
- the type of elements in this listpublic final class NonEmptyList<A> extends AbstractList<A>
List
implementation that is guaranteed to contain at least one item.modCount
Constructor and Description |
---|
NonEmptyList(A head,
List<A> tail) |
Modifier and Type | Method and Description |
---|---|
<B> B |
fold(java.util.function.Function<A,B> initialResult,
java.util.function.BiFunction<B,A,B> op) |
<B> B |
foldLeft(B b,
java.util.function.BiFunction<B,A,B> op) |
static <A> Optional<NonEmptyList<A>> |
fromList(List<A> l) |
A |
get(int index) |
A |
head() |
A |
last() |
<B> NonEmptyList<B> |
map(java.util.function.Function<A,B> op) |
static <A> NonEmptyList<A> |
of(A a,
A... as) |
boolean |
removeIf(java.util.function.Predicate<? super A> filter) |
void |
replaceAll(java.util.function.UnaryOperator<A> operator) |
int |
size() |
void |
sort(Comparator<? super A> c) |
List<A> |
tail() |
List<A> |
toList() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, spliterator, toArray, toArray
parallelStream, stream
@SafeVarargs public static <A> NonEmptyList<A> of(A a, A... as)
public static <A> Optional<NonEmptyList<A>> fromList(List<A> l)
public A get(int index)
public int size()
size
in interface Collection<A>
size
in interface List<A>
size
in class AbstractCollection<A>
public boolean removeIf(java.util.function.Predicate<? super A> filter)
public void replaceAll(java.util.function.UnaryOperator<A> operator)
public void sort(Comparator<? super A> c)
public <B> NonEmptyList<B> map(java.util.function.Function<A,B> op)
public A head()
public A last()
public <B> B fold(java.util.function.Function<A,B> initialResult, java.util.function.BiFunction<B,A,B> op)
public <B> B foldLeft(B b, java.util.function.BiFunction<B,A,B> op)
Copyright © 2019. All rights reserved.