Payload - The payload typepublic interface Source<Payload> extends ProtectedIterable<Payload>
Source is a read-only data structure.
A Source is intended to be used in APIs that want to expose read-only
access to a collection of payload values.
It is, amongst other things, intended as a more expressive replacement for
Collections.unmodifiableCollection(java.util.Collection) that
prevents unnecessary runtime exceptions.
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object reference)
|
boolean |
containsAll(Iterable<?> references)
|
boolean |
containsAll(Object... references)
|
boolean |
containsMatch(Predicate<? super Payload> predicate)
|
Source<Payload> |
getAll(Payload reference)
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. |
int |
size()
Returns the number of payload values of this
Source. |
iteratorforEach, spliteratorboolean isEmpty()
Source is empty.Source is empty.int size()
Source.Source.Payload getFirst() throws NoSuchElementException
iterator) payload value.NoSuchElementException - If this IndexedSource is
empty.Optional<Payload> getFirst(Payload reference)
iterator of this Source) occurrences, by
equality, of the given reference payload
value.reference - The reference payload to be used.Optional yielding the payload value.Optional<Payload> getFirstMatch(Predicate<? super Payload> predicate) throws IllegalArgumentException
iterator of this Source) payload value that satisfies the given
Predicate.predicate - The Predicate to be used.Optional yielding the payload value.IllegalArgumentException - If the given Predicate is null.Source<Payload> getAll(Payload reference)
equality, of
the given reference payload value.reference - The reference payload to be used.Source yielding the payload values.Source<Payload> getAllMatches(Predicate<? super Payload> predicate) throws IllegalArgumentException
Predicate.predicate - The Predicate to be used.Source yielding the payload values.IllegalArgumentException - If the given Predicate is null.boolean contains(Object reference)
reference - The reference payload value to be checked.Source contains the given reference payload
value.boolean containsMatch(Predicate<? super Payload> predicate) throws IllegalArgumentException
predicate - The Predicate to be used.Source contains a payload value that
satisfies the given Predicate.IllegalArgumentException - if the given Predicate is null.boolean containsAll(Object... references) throws IllegalArgumentException
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.boolean containsAll(Iterable<?> references) throws IllegalArgumentException
references - The Iterable of reference payload values to be
checked.Source contains all of the given payload
values.IllegalArgumentException - If the given Iterable of reference payload values is
null.Copyright © 2016–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.