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  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: #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: 532 / 620
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)