1 | static <A> Collection<A> filterByField_smart(Collection<A> l, S field, O value) {
|
2 | if (l == null) null; |
3 | for (A n : l) |
4 | if (!eq(getOpt(n, field), value)) {
|
5 | Iterator<A> it = iterator(l); |
6 | A node; |
7 | new L<A> x; |
8 | while ((node = it.next()) != n) |
9 | x.add(node); |
10 | while (it.hasNext()) {
|
11 | node = it.next(); |
12 | if (eq(getOpt(node, field), value)) |
13 | x.add(node); |
14 | } |
15 | ret x; |
16 | } |
17 | ret l; |
18 | } |
Began life as a copy of #1002319
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1011433 |
| Snippet name: | filterByField_smart - avoids making an unnecessary list |
| Eternal ID of this version: | #1011433/3 |
| Text MD5: | 5d2809917feb380020a9b08ed7cf7102 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-10-29 02:36:51 |
| Source code size: | 464 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 732 / 726 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |