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

7
LINES

< > BotCompany Repo | #1011007 // ai_first - get first element of list, note if list has multiple elements

JavaX fragment (include)

static <A> A ai_first(Collection<A> l) {
  if (empty(l)) null;
  Iterator<A> it = l.iterator();
  A a = it.next();
  if (it.hasNext()) warn("Choosing first element of multiple");
  ret a;
}

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: #1011007
Snippet name: ai_first - get first element of list, note if list has multiple elements
Eternal ID of this version: #1011007/1
Text MD5: 76c43fc6f64091850b23106d6a23cbab
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-11 17:06:56
Source code size: 195 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 358 / 392
Referenced in: [show references]