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

14
LINES

< > BotCompany Repo | #1025517 // indicesOf_array

JavaX fragment (include)

static <A> int[] indicesOf_array(L<A> l, A a) {
  if (l == null) null;
  
  ifclass IContentsIndexedList
  if (l cast IContentsIndexedList)
    ret i.indicesOf(a);
  endif
  
  new L<Int> x;
  for (int i = 0; i < l(l); i++)
    if (eq(l.get(i), a))
      x.add(i);
  ret toIntArray(x);
}

Author comment

Began life as a copy of #1025514

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025517
Snippet name: indicesOf_array
Eternal ID of this version: #1025517/1
Text MD5: 8269ab73fe6d4177f9e83b692799b9ba
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-01 18:15:11
Source code size: 300 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 220 / 252
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)