Libraryless. Click here for Pure Java version (10694L/59K).
static <A> A lastThat(L<A> l, O pred) { for (int i = l(l)-1; i >= 0; i--) { A a = l.get(i); if (checkCondition(pred, a)) ret a; } null; } static <A> A lambdaMapLike lastThat(O pred, L<A> l) { ret lastThat(l, pred); } static <A> A lastThat(IPred<A> pred, L<A> l) { ret lastThat((O) pred, l); } static <A> A lastThat(L<A> l, IPred<A> pred) { ret lastThat(pred, l); } static <A> A lastThat(Iterable<A> l, IPred<A> pred) { A x = null; if (l != null) for (a : l) if (pred.get(a)) x = a; ret x; }
Began life as a copy of #1006407
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1021565 |
Snippet name: | lastThat - find last element in list that matches a predicate |
Eternal ID of this version: | #1021565/5 |
Text MD5: | 0d3062616642776294c0ec66276e8dd1 |
Transpilation MD5: | a9cf29ad313083f930cab877d892a04b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-08-07 16:53:12 |
Source code size: | 563 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 420 / 503 |
Version history: | 4 change(s) |
Referenced in: | [show references] |