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

12
LINES

< > BotCompany Repo | #1022376 // replaceNullValuesWith - clone map, replace all nulö values with some object

JavaX fragment (include)

static <A, B> Map<A, B> replaceNullValuesWith(Map<A, B> map, B value) {
  if (map == null) null;
  Map<A, B> m = similarEmptyMap(map);
  for (A a, B b : map) {
    m.put(a, or(b, value));
  }
  ret m;
}

static <A, B> Map<A, B> replaceNullValuesWith(B value, Map<A, B> map) {
  ret replaceNullValuesWith(map, value);
}

Author comment

Began life as a copy of #1014256

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, lnbujpyubztb, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022376
Snippet name: replaceNullValuesWith - clone map, replace all nulö values with some object
Eternal ID of this version: #1022376/3
Text MD5: bad77487bc00509ab281719291ffdabe
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-16 12:08:55
Source code size: 329 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 237 / 264
Version history: 2 change(s)
Referenced in: [show references]