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

5
LINES

< > BotCompany Repo | #1014175 // randomValue - random value from a map

JavaX fragment (include)

static <A, B> B randomValue(Map<A, B> map) {
  if (map == null) null;
  A key = random(keys(map));
  ret key == null ? null : map.get(key);
}

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: #1014175
Snippet name: randomValue - random value from a map
Eternal ID of this version: #1014175/2
Text MD5: 8cb90bc79a8a140ad076471226f61b4c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-15 14:49:14
Source code size: 145 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 329 / 351
Version history: 1 change(s)
Referenced in: [show references]