public abstract class SimpleQuery<T extends SimpleQuery<T,K>,K>
extends java.lang.Object
implements java.lang.Iterable<K>
Modifier and Type | Method and Description |
---|---|
boolean |
contains(K item)
Checks if the query contains the specified item
|
T |
filter(java.util.function.Predicate<K> condition)
Will filter out all items that do not pass the specified predicate condition
|
boolean |
isEmpty()
Will return if the query is empty
|
java.util.Iterator<K> |
iterator() |
K |
next()
Returns the next item in the query whilst removing it from the query
|
K |
peekNext()
Returns the next item in the query without popping it from the query
|
T |
populate()
Will clear the current query and populate it with newly grabbed items
|
int |
population()
Will return the amount of items inside of the query
|
T |
reverse()
Will reverse the order of the items in the query making the first item the last and so on
|
T |
shuffle()
Will shuffle the order of the items in the query randomly
|
int |
size()
Will return the amount of items inside of the query
|
T |
sort(java.util.Comparator<? super K> comparator)
Will sort the query by the specified comparator
|
java.util.stream.Stream<K> |
toStream()
Will return a stream of the current query
|
public final java.util.stream.Stream<K> toStream()
public T populate()
public int population()
public boolean isEmpty()
public K next()
public K peekNext()
public T filter(java.util.function.Predicate<K> condition)
condition
- the condition to filter the query bypublic T sort(java.util.Comparator<? super K> comparator)
comparator
- the comparator to sort the query bypublic T shuffle()
public T reverse()
public java.util.Iterator<K> iterator()
iterator
in interface java.lang.Iterable<K>
public boolean contains(K item)
item
- object to check if the query containspublic int size()