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

13
LINES

< > BotCompany Repo | #1008758 - getThreadLocal - synonym of getThreadLocalOpt + another version

JavaX fragment (include)

// this syntax should be removed...
static O getThreadLocal(O o, S name) {
  ThreadLocal t = cast getOpt(o, name);
  ret t != null ? t.get() : null;
}

static <A> A getThreadLocal(ThreadLocal<A> tl) {
  ret tl == null ? null : tl!;
}

static <A> A getThreadLocal(ThreadLocal<A> tl, A defaultValue) {
  ret or(getThreadLocal(tl), defaultValue);
}

Author comment

Began life as a copy of #1007890

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1008758
Snippet name: getThreadLocal - synonym of getThreadLocalOpt + another version
Eternal ID of this version: #1008758/6
Text MD5: 4cf9b5fc63ec6cad523016e18aeb1cf6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-10 15:45:39
Source code size: 357 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 292 / 328
Version history: 5 change(s)
Referenced in: [show references]

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