@ParametersAreNonnullByDefault public class DefaultJohnsonEventContainer extends Object implements JohnsonEventContainer
JohnsonEventContainer which stores events in a list.
Note: This implementation is thread-safe.
| Constructor and Description |
|---|
DefaultJohnsonEventContainer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEvent(Event event)
Adds the provided
Event to the list. |
Optional<Event> |
firstEvent(Predicate<? super Event> predicate)
Returns the first event (if any) that satisfies the given predicate.
|
List<Event> |
getEvents()
Retrieves an unmodifiable view of the current
Event list. |
Collection<Event> |
getEvents(Predicate<? super Event> predicate)
Returns any events that satisfy the given predicate.
|
boolean |
hasEvent(Predicate<? super Event> predicate)
Indicates whether this container has any events that satisfy the given predicate.
|
boolean |
hasEvents()
Retrieves a flag indicating whether there are any
Events in the list. |
void |
removeEvent(Event event)
Removes the provided
Event from the list, if it can be found. |
public void addEvent(Event event)
Event to the list.addEvent in interface JohnsonEventContainerevent - the event to add@Nonnull public List<Event> getEvents()
Event list.getEvents in interface JohnsonEventContainerpublic boolean hasEvents()
Events in the list.hasEvents in interface JohnsonEventContainertrue if the event list is not empty; otherwise, falsepublic void removeEvent(Event event)
Event from the list, if it can be found.removeEvent in interface JohnsonEventContainerevent - the event to removepublic Collection<Event> getEvents(Predicate<? super Event> predicate)
JohnsonEventContainergetEvents in interface JohnsonEventContainerpredicate - the predicate to evaluatepublic boolean hasEvent(Predicate<? super Event> predicate)
JohnsonEventContainerJohnsonEventContainer.firstEvent(Predicate) followed by
Optional.isPresent().hasEvent in interface JohnsonEventContainerpredicate - the predicate to evaluatefalseif no events matchpublic Optional<Event> firstEvent(Predicate<? super Event> predicate)
JohnsonEventContainerfirstEvent in interface JohnsonEventContainerpredicate - the predicate to evaluateJohnsonEventContainer.getEvents()Copyright © 2017 Atlassian. All rights reserved.