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

7
LINES

< > BotCompany Repo | #1006201 // setAddOrMoveToEnd

JavaX fragment (include)

1  
static <A> bool setAddOrMoveToEnd(L<A> l, A a) {
2  
  int i = l.indexOf(a);
3  
  if (i >= 0 && i == l(l)-1) false;
4  
  if (i >= 0) l.remove(i);
5  
  l.add(a);
6  
  true;
7  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006201
Snippet name: setAddOrMoveToEnd
Eternal ID of this version: #1006201/1
Text MD5: 5ff65987957e7351c9fcfef5e185d7e0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-23 03:27:25
Source code size: 163 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 498 / 509
Referenced in: [show references]