Package dev.twilite.game.stream
Class View<T>
java.lang.Object
dev.twilite.game.stream.View<T>
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
BaseItemView,ComponentView,GrandExchangeOfferView,ServerView,UnitView
Lazy filtered view over game API objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcount()Counts matching elements.booleanexists()Returns whether the view contains at least one element.Returns a new view with an additional filter.first()Returns the first matching element.iterator()Iterates over matching elements.<R> Stream<R> Maps matching elements into another stream.mapToInt(ToIntFunction<T> mapper) Maps matching elements into an int stream.not()Returns a new view with the most recent filter negated.Returns a new view with the supplied filter OR'ed with the most recent filter.stream()Opens a stream of matching elements.toList()Materializes the current view into a list.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
View
Creates a view backed by a stream supplier.
-
-
Method Details
-
filter
Returns a new view with an additional filter. -
not
Returns a new view with the most recent filter negated. -
or
Returns a new view with the supplied filter OR'ed with the most recent filter. -
first
Returns the first matching element. -
toList
Materializes the current view into a list. -
map
Maps matching elements into another stream. -
mapToInt
Maps matching elements into an int stream. -
count
public int count()Counts matching elements. -
exists
public boolean exists()Returns whether the view contains at least one element. -
stream
Opens a stream of matching elements. -
iterator
Iterates over matching elements.
-