Skip to content

Commit

Permalink
- B parity of Lists an Arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
isidore committed Nov 22, 2024
1 parent 948311f commit 4aa3a52
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions approvaltests-util/src/main/java/org/lambda/query/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ public static <In> In first(Iterable<In> list, Function1<In, Boolean> filter)
}
return null;
}
public static <In, E extends Throwable> In firstOrThrow(In[] list, Function1<In, Boolean> filter, Function0<E> exception) throws E {
return firstOrThrow(Arrays.asList(list), filter, exception);
}
public static <In, E extends Throwable> In firstOrThrow(Iterable<In> list, Function1<In, Boolean> filter, Function0<E> exception) throws E {
In i = first(list, filter);
if (i == null) {
throw exception.call();
}
return i;
In i = first(list, filter);
if (i == null) {
throw exception.call();
}
return i;
}
public static <In> Queryable<In> where(In[] list, Function1<In, Boolean> filter)
{
Queryable<In> out = new Queryable<In>();
Expand Down

0 comments on commit 4aa3a52

Please sign in to comment.