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

10
LINES

< > BotCompany Repo | #1022681 // jlist_indexOf

JavaX fragment (include)

static <A> int jlist_indexOf(JList<A> list, A item) {
  ret swing(func -> int {
    ListModel<A> model = list.getModel();
    int n = model.getSize();
    for i to n:
      if (eq(model.getElementAt(i), item))
        ret i;
    ret -1;
  });
}

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: #1022681
Snippet name: jlist_indexOf
Eternal ID of this version: #1022681/2
Text MD5: f7ebfc10848c1aa3d9d3636529ea7f95
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-31 16:53:00
Source code size: 253 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 329 / 376
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)