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

15
LINES

< > BotCompany Repo | #1027804 // multiMapIndex

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3123L/18K).

// does not store null values
static <B, A> MultiMap<B, A> lambdaMapLike multiMapIndex(IF1<A, B> f, Iterable<A> l) {
  new MultiMap<B, A> map;
  fOr (A a : l) {
    B val = f.get(a);
    if (val != null)
      map.put(val, a);
  }
  ret map;
}


static <B, A> MultiMap lambdaMapLike multiMapIndex(Iterable<A> l, IF1<A, B> f) {
  ret multiMapIndex(f, l);
}

Author comment

Began life as a copy of #1011312

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027804
Snippet name: multiMapIndex
Eternal ID of this version: #1027804/6
Text MD5: 0099a133b91c1b09038d181be1f7959a
Transpilation MD5: 5e2eaa77262b194f7f641d593d7c0ab8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-28 15:32:12
Source code size: 369 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 129 / 218
Version history: 5 change(s)
Referenced in: [show references]