Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1023246 // indicesOfAny

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1483L/10K).

static <A> L<Int> indicesOfAny(L<A> l, Set<A> set) {
  ret indicesOfAny(l, set, 0);
}

static <A> L<Int> indicesOfAny(L<A> l, Set<A> set, int startIdx) {
  new L<Int> x;
  if (nempty(set)) {
    int n = l(l);
    for (int i = startIdx; i < n; i++)
      if (set.contains(l.get(i)))
        x.add(i);
  }
  ret x;
}

Author comment

Began life as a copy of #1017945

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023246
Snippet name: indicesOfAny
Eternal ID of this version: #1023246/3
Text MD5: d42663ef576d79c6c542a148d5a231d3
Transpilation MD5: 78e4c4d2cd117bc6f74de261bef70c88
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-19 13:22:34
Source code size: 327 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 224
Version history: 2 change(s)
Referenced in: [show references]