1 | static <A> A firstThatNot(Iterable<A> l, IF1<A, Bool> pred) { |
2 | fOr (A a : l) |
3 | if (!pred.get(a)) |
4 | ret a; |
5 | null; |
6 | } |
7 | |
8 | static <A> A firstThatNot(A[] l, IF1<A, Bool> pred) { |
9 | fOr (A a : l) |
10 | if (!pred.get(a)) |
11 | ret a; |
12 | null; |
13 | } |
14 | |
15 | static <A> A lambdaMapLike firstThatNot(IF1<A, Bool> pred, Iterable<A> l) { |
16 | ret firstThatNot(l, pred); |
17 | } |
18 | |
19 | static <A> A lambdaMapLike firstThatNot(IF1<A, Bool> pred, A[] l) { |
20 | ret firstThatNot(l, pred); |
21 | } |
Began life as a copy of #1006407
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033231 |
Snippet name: | firstThatNot - find first element in list that doesn't match a predicate |
Eternal ID of this version: | #1033231/1 |
Text MD5: | fb18ed88d11c494f4043edc3c36d8c6d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-16 07:30:23 |
Source code size: | 468 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 195 / 223 |
Referenced in: | [show references] |