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

10
LINES

< > BotCompany Repo | #1030741 // ciMapToKeys - iterate on list, keep object as value, function result as key

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

Libraryless. Click here for Pure Java version (2776L/16K).

static <A> Map<S, A> lambdaMapLike ciMapToKeys(IF1<A, S> f, Iterable<A> l) {
  Map<S, A> map = ciMap();
  fOr (A a : l)
    map.put(f.get(a), a);
  ret map;
}

static <A> Map<S, A> ciMapToKeys(Iterable<A> l, IF1<A, S> f) {
  ret ciMapToKeys(f, l);
}

Author comment

Began life as a copy of #1028140

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030741
Snippet name: ciMapToKeys - iterate on list, keep object as value, function result as key
Eternal ID of this version: #1030741/6
Text MD5: cd40666af0ba6cc5f080173fc0da21d6
Transpilation MD5: 54176bd6d72b927e1655615884f612eb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-18 21:04:23
Source code size: 258 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 103 / 161
Version history: 5 change(s)
Referenced in: [show references]