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

3
LINES

< > BotCompany Repo | #1001799 // safeGet - get from list, returning null if out of range

JavaX fragment (include)

static <A> A safeGet(L<A> l, int i) {
  ret i >= 0 && i < l(l) ? l.get(i) : null;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001799
Snippet name: safeGet - get from list, returning null if out of range
Eternal ID of this version: #1001799/1
Text MD5: 3e46979adbde267c5380eb75c45eab21
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-11-16 19:39:35
Source code size: 85 bytes / 3 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 583 / 830
Referenced in: [show references]