Olav Hermansen
03/03/2019, 8:14 AMitems.stream().filter { it.someStuff.equals(search) }.findFirst().orElseThrow( *insert exception* )
I tried to put UnsupportedOperationException() but get problem with ExceptionSupplier. How should I do this?tseisel
03/03/2019, 10:20 AMorElseThrow { UnsupportedOperationException() }
OR
orElseThrow(::UnsupportedOperationException)
The latter is a function reference that is equivalent to orElseThrow(UnsupportedOperationException::new)
is Java.Olav Hermansen
03/03/2019, 2:32 PMMike
03/03/2019, 10:17 PMfilter
followed by findFirst
can be replaced by find
.Olav Hermansen
03/04/2019, 8:09 AM