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

13
LINES

< > BotCompany Repo | #1012674 - syncGet

JavaX fragment (include)

static <A> A syncGet(L<A> l, int idx) {
  if (l == null || idx < 0) null;
  synchronized(l) {
    ret idx < l(l) ? l.get(idx) : null;
  }
}

static <A, B> B syncGet(Map<A, B> map, A a) {
  if (map == null) null;
  synchronized(map) {
    ret map.get(a);
  }
}

Author comment

Began life as a copy of #1003807

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1012674
Snippet name: syncGet
Eternal ID of this version: #1012674/2
Text MD5: 02877e657120a43224225837a6bd8bdf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-24 22:55:20
Source code size: 271 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 265 / 273
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1012674 & http://1012674.tinybrain.de