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

17
LINES

< > BotCompany Repo | #1028990 // mapToTreeSet - map function, return as tree set

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

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

static TreeSet mapToTreeSet(O f, Iterable l) {
  new TreeSet x;
  if (l != null) for (O o : l)
    x.add(callF(f, o));
  ret x;
}

static <A, B> TreeSet<B> lambdaMapLike mapToTreeSet(IF1<A, B> f, Iterable<A> l) {
  new TreeSet<B> x;
  if (l != null) for (o : l)
    x.add(f.get(o));
  ret x;
}

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

Author comment

Began life as a copy of #1011181

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1028990
Snippet name: mapToTreeSet - map function, return as tree set
Eternal ID of this version: #1028990/3
Text MD5: 1d85e3b9dca83fe2829b0686cc7fcefe
Transpilation MD5: 2c96d4a0d89d52a52e6a1b45c145219e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-29 05:44:56
Source code size: 420 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 129 / 206
Version history: 2 change(s)
Referenced in: [show references]