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

8
LINES

< > BotCompany Repo | #1016979 - syncAdd - add & synchronize on collection

JavaX fragment (include)

static <A> bool syncAdd(Collection<A> c, A b) {
  if (c == null) false;
  synchronized(c) { ret c.add(b); }
}

static <A> void syncAdd(L<A> l, int idx, A b) {
  if (l != null) synchronized(l) { l.add(idx, b); }
}

Author comment

Began life as a copy of #1016969

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1016979
Snippet name: syncAdd - add & synchronize on collection
Eternal ID of this version: #1016979/3
Text MD5: 5b38331195c579c47bcbc64a9f51140f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-03 15:19:57
Source code size: 219 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 154
Version history: 2 change(s)
Referenced in: [show references]

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