Class StreamUtil
Helper class for wrapping around the java stream library. Miserably attempts to mimic C# Linq.
Inheritance
java.lang.Object
StreamUtil
Inherited Members
java.lang.Object.clone()
java.lang.Object.equals(java.lang.Object)
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.hashCode()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.toString()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)
Namespace:
Assembly: .dll
Syntax
public final class StreamUtil
Constructors
StreamUtil()
Declaration
public StreamUtil()
Methods
<T>contains(Iterable<T> iterable, Predicate<T> predicate)
Returns whether an iterable contains an item for which the given predicate returns true.
Declaration
public static boolean <T>contains(Iterable<T> iterable, Predicate<T> predicate)
Parameters
Type | Name | Description |
---|---|---|
java.lang.Iterable<T> | iterable | The iterable |
java.util.function.Predicate<T> | predicate | The predicate |
Returns
Type | Description |
---|---|
boolean | True if the iterable contains the item |
<T>firstOrNull(Iterable<T> iterable, Predicate<T> predicate)
Returns the first item from an iterable for which the given predicate returns true. If no item is found null is returned instead.
Declaration
public static T <T>firstOrNull(Iterable<T> iterable, Predicate<T> predicate)
Parameters
Type | Name | Description |
---|---|---|
java.lang.Iterable<T> | iterable | The iterable |
java.util.function.Predicate<T> | predicate | The predicate |
Returns
Type | Description |
---|---|
T | The first found item if found in iterable, null else |