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

13
LINES

< > BotCompany Repo | #1011781 // first_sync function - first() with synchronize

JavaX fragment (include)

static <A> A first_sync(L<A> list) {
  synchronized(list) {
    ret empty(list) ? null : list.get(0);
  }
}

static <A> A first_sync(Iterable<A> i) {
  if (i == null) null;
  synchronized(i) {
    Iterator<A> it = i.iterator();
    ret it.hasNext() ? it.next() : null;
  }
}

Author comment

Began life as a copy of #1000628

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: #1011781
Snippet name: first_sync function - first() with synchronize
Eternal ID of this version: #1011781/1
Text MD5: 70f5d0bf4df5544fba0e640de9be7e63
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-05 03:54:17
Source code size: 286 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 472
Referenced in: [show references]