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

10
LINES

< > BotCompany Repo | #1022681 // jlist_indexOf

JavaX fragment (include)

1  
static <A> int jlist_indexOf(JList<A> list, A item) {
2  
  ret swing(func -> int {
3  
    ListModel<A> model = list.getModel();
4  
    int n = model.getSize();
5  
    for i to n:
6  
      if (eq(model.getElementAt(i), item))
7  
        ret i;
8  
    ret -1;
9  
  });
10  
}

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: 328 / 375
Version history: 1 change(s)
Referenced in: [show references]