public class ManifoldListCollectionExt
extends java.lang.Object
| Constructor and Description |
|---|
ManifoldListCollectionExt() |
| Modifier and Type | Method and Description |
|---|---|
static <E> E |
first(java.util.List<E> thiz)
Returns first element.
|
static <E> E |
firstOrNull(java.util.List<E> thiz)
Returns the first element, or null if the list is empty.
|
static <E> E |
getOrNull(java.util.List<E> thiz,
int index)
Returns an element at the given
index or null if the index is out of bounds of this list. |
static <E> E |
last(java.util.List<E> thiz)
Returns the last element.
|
static <E> E |
last(java.util.List<E> thiz,
java.util.function.Predicate<E> predicate)
Returns the last element matching the given
predicate. |
static <E> E |
lastOrNull(java.util.List<E> thiz)
Returns the last element, or
null if the list is empty. |
static <E> E |
lastOrNull(java.util.List<E> thiz,
java.util.function.Predicate<E> predicate)
Returns the last element matching the given
predicate, or null if no such element was found. |
static <E> java.util.List<E> |
optimizeReadOnlyList(java.util.List<E> thiz) |
static <E> void |
reverse(java.util.List<E> thiz)
Reverses elements in the list in-place.
|
static <E> E |
single(java.util.List<E> thiz)
Returns the single element, or throws an exception if the list is empty or has more than one element.
|
static <E> E |
singleOrNull(java.util.List<E> thiz)
Returns single element, or
null if the list is empty or has more than one element. |
public static <E> E first(java.util.List<E> thiz)
java.util.NoSuchElementException - if the list is empty.public static <E> E firstOrNull(java.util.List<E> thiz)
public static <E> E last(java.util.List<E> thiz)
java.util.NoSuchElementException - if the list is empty.public static <E> E last(java.util.List<E> thiz,
java.util.function.Predicate<E> predicate)
predicate.java.util.NoSuchElementException - if no such element is found.public static <E> E lastOrNull(java.util.List<E> thiz)
null if the list is empty.public static <E> E lastOrNull(java.util.List<E> thiz,
java.util.function.Predicate<E> predicate)
predicate, or null if no such element was found.public static <E> E single(java.util.List<E> thiz)
public static <E> E singleOrNull(java.util.List<E> thiz)
null if the list is empty or has more than one element.public static <E> E getOrNull(java.util.List<E> thiz,
int index)
index or null if the index is out of bounds of this list.public static <E> void reverse(java.util.List<E> thiz)
public static <E> java.util.List<E> optimizeReadOnlyList(java.util.List<E> thiz)
Copyright © 2022. All rights reserved.