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

15
LINES

< > BotCompany Repo | #1011181 // mapToHashSet - map function, return as hash set

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

Libraryless. Click here for Pure Java version (5067L/28K).

ifndef EnforceFunctionTypes
static HashSet mapToHashSet(O f, Iterable l) {
  HashSet x = l cast Cl ? new HashSet(l.size()) : new HashSet;
  if (l != null) for (O o : l)
    x.add(callF(f, o));
  ret x;
}
endifndef

static <A, B> HashSet<B> lambdaMapLike mapToHashSet(IF1<A, B> f, Iterable<A> l) {
  HashSet<B> x = l cast Cl ? new HashSet(l.size()) : new HashSet;
  if (l != null) for (A o : l)
    x.add(f.get(o));
  ret x;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1011181
Snippet name: mapToHashSet - map function, return as hash set
Eternal ID of this version: #1011181/16
Text MD5: 4178a119c7d0666f4b36eb5efe691031
Transpilation MD5: feada48935ffc3e67627db9cfdaf3797
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-12 22:58:27
Source code size: 439 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 516 / 661
Version history: 15 change(s)
Referenced in: [show references]