public final class OptionalListExtensions
extends java.lang.Object
List objects| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.Optional<T> |
getFirst(java.util.List<T> list)
Returns an
Optional with the first object from the given List |
static <T> java.util.Optional<T> |
getLast(java.util.List<T> list)
Returns an
Optional with the last object from the given List |
static <T> java.util.Optional<T> |
getNext(java.util.List<T> list,
T element)
Gets the next element from the given
List. |
static <T> java.util.Optional<T> |
getPrevious(java.util.List<T> list,
T element)
Gets the previous element from the given
List. |
static <T> java.util.Optional<T> |
removeFirst(java.util.List<T> list)
Returns an
Optional with the first object if it was removed from the given
List |
static <T> java.util.Optional<T> |
removeLast(java.util.List<T> list)
Returns an
Optional with the last object if it was removed from the given
List |
public static <T> java.util.Optional<T> getFirst(java.util.List<T> list)
Optional with the first object from the given ListT - the generic type of the elementslist - the List objectOptional with the first object from the given List or an empty
Optional if the List is emptypublic static <T> java.util.Optional<T> getLast(java.util.List<T> list)
Optional with the last object from the given ListT - the generic type of the elementslist - the List objectOptional with the last object from the given List or an empty
Optional if the List is emptypublic static <T> java.util.Optional<T> getNext(java.util.List<T> list,
T element)
List. As start point is the given elementT - the generic type of elementslist - the listelement - the elementOptional with the next element from the given List or an empty
Optional if the List has no next elementpublic static <T> java.util.Optional<T> getPrevious(java.util.List<T> list,
T element)
List. As start point is the given elementT - the generic type of elementslist - the listelement - the elementOptional with the previous element from the given List or an empty
Optional if the List has no previous elementpublic static <T> java.util.Optional<T> removeFirst(java.util.List<T> list)
Optional with the first object if it was removed from the given
ListT - the generic type of the elementslist - the List objectOptional with the first object if it was removed from the given
List or an empty Optional if the List is emptypublic static <T> java.util.Optional<T> removeLast(java.util.List<T> list)
Optional with the last object if it was removed from the given
ListT - the generic type of the elementslist - the List objectOptional with the last object if it was removed from the given
List or an empty Optional if the List is empty