Payload - The payload type.public abstract class AbstractSource<Payload> extends Object implements Source<Payload>
AbstractSource is an abstract base implementation of a
Source.| Constructor and Description |
|---|
AbstractSource() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object reference)
|
boolean |
containsAll(Iterable<?> references)
|
boolean |
containsAll(Object... references)
|
boolean |
containsMatch(Predicate<? super Payload> predicate)
|
protected Predicate<Payload> |
createPredicate(Payload payload)
Creates and returns a
Predicate that is satisfied, if the test
subject is equal to the given payload value. |
protected Payload |
doGetFirst()
Returns the first (i.e.
|
protected static <Payload> Optional<Integer> |
firstIndexOf(Iterator<? extends Payload> iterator,
Predicate<? super Payload> predicate)
Returns the index of the first payload value that satisfies the give
Predicate. |
Source<Payload> |
getAll(Payload payload)
Returns all occurrences, by
equality, of
the given reference payload value. |
Source<Payload> |
getAllMatches(Predicate<? super Payload> predicate)
Returns the payload values that satisfy the given
Predicate. |
Payload |
getFirst()
Returns the first (i.e.
|
Optional<Payload> |
getFirst(Payload reference)
Returns the first (i.e.
|
Optional<Payload> |
getFirstMatch(Predicate<? super Payload> predicate)
Returns the first (i.e.
|
boolean |
isEmpty()
Returns whether this
Source is empty. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waititeratorforEach, spliteratorpublic final boolean isEmpty()
SourceSource is empty.public final Payload getFirst() throws NoSuchElementException
Sourceiterator) payload value.getFirst in interface Source<Payload>NoSuchElementException - If this IndexedSource is
empty.protected Payload doGetFirst()
iterator) payload value, which is guaranteed to
exist.public final Optional<Payload> getFirst(Payload reference)
Sourcepublic final Optional<Payload> getFirstMatch(Predicate<? super Payload> predicate) throws IllegalArgumentException
Sourceiterator of this Source) payload value that satisfies the given
Predicate.getFirstMatch in interface Source<Payload>predicate - The Predicate to be used.Optional yielding the payload value.IllegalArgumentException - If the given Predicate is null.public final Source<Payload> getAll(Payload payload)
Sourceequality, of
the given reference payload value.public final Source<Payload> getAllMatches(Predicate<? super Payload> predicate) throws IllegalArgumentException
SourcePredicate.getAllMatches in interface Source<Payload>predicate - The Predicate to be used.Source yielding the payload values.IllegalArgumentException - If the given Predicate is null.public final boolean containsMatch(Predicate<? super Payload> predicate) throws IllegalArgumentException
SourcecontainsMatch in interface Source<Payload>predicate - The Predicate to be used.Source contains a payload value that
satisfies the given Predicate.IllegalArgumentException - if the given Predicate is null.public final boolean containsAll(Object... references) throws IllegalArgumentException
SourcecontainsAll in interface Source<Payload>references - The array of reference payload values to be checked.Source contains all of the given payload
values.IllegalArgumentException - If the given array of reference payload values is
null.public final boolean containsAll(Iterable<?> references)
SourcecontainsAll in interface Source<Payload>references - The Iterable of reference payload values to be
checked.Source contains all of the given payload
values.protected final Predicate<Payload> createPredicate(Payload payload)
Predicate that is satisfied, if the test
subject is equal to the given payload value.payload - The payload value to be used.Predicate.Copyright © 2016–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.