Libraryless. Click here for Pure Java version (5026L/28K).
1 | static <A> Cl<HasIndex> indicesOf_collectionOfHasIndex(L<A> l, A a) { |
2 | if (l == null) null; |
3 | |
4 | ifclass IContentsIndexedList2 |
5 | if (l cast IContentsIndexedList2) |
6 | ret l.indicesOf_treeSetOfHasIndex(a); |
7 | endif |
8 | |
9 | new L<HasIndex> x; |
10 | int n = l(l); |
11 | for (int i = 0; i < n; i++) |
12 | if (eq(l.get(i), a)) |
13 | x.add(HasIndex(i)); |
14 | ret x; |
15 | } |
Began life as a copy of #1025514
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034672 |
Snippet name: | indicesOf_collectionOfHasIndex - faster with IContentsIndexedList2, similar speed as indicesOf for normal list |
Eternal ID of this version: | #1034672/1 |
Text MD5: | 47d8c39e1618162852a3cdb5c5a1fca2 |
Transpilation MD5: | fde40c2b53cc1de394ed0d9e9b7304d5 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-01 16:43:28 |
Source code size: | 359 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 226 |
Referenced in: | [show references] |