find
Returns the first element in this that satisfies the given predicate; use this method only when such an element is known to exist. If it is possible that no element will match, use tryFind or find instead.
Stream equivalent: stream.filter(predicate).findFirst().get()
See also
Throws
if no element in this matches the given predicate and defaultValue is null.
Returns the first element in this that satisfies the given predicate; use this method only when such an element is known to exist. The iterator will be left exhausted: its hasNext method will return false. If it is possible that no element will match, use Iterator.tryFind or Iterator.find instead.
Warning: avoid using a predicate that matches null. If null is matched in this, a NullPointerException will be thrown.
See also
Throws
if no element in this matches the given predicate and defaultValue is null.