Libraryless. Click here for Pure Java version (2499L/16K).
1 | // returns true if anything was removed |
2 | static <A> bool lambdaMapLike removeElementsThat(IPred<A> pred, Cl<A> c) {
|
3 | if (c == null || pred == null) false; |
4 | Iterator<A> it = iterator(c); |
5 | bool change; |
6 | while (it.hasNext()) |
7 | if (pred.get(it.next())) {
|
8 | it.remove(); |
9 | set change; |
10 | } |
11 | ret change; |
12 | } |
13 | |
14 | static <A> bool removeElementsThat(Cl<A> c, IPred<A> pred) {
|
15 | ret removeElementsThat(pred, c); |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028060 |
| Snippet name: | removeElementsThat - remove elements from collection matching a predicate |
| Eternal ID of this version: | #1028060/5 |
| Text MD5: | d3befb2f1dec046cbeadec697dbed1e5 |
| Transpilation MD5: | 5eaf8376985d63a551841fa3dbaee7f8 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-05-15 12:40:30 |
| Source code size: | 428 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 396 / 546 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |