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).

1  
static TreeSet mapToTreeSet(O f, Iterable l) {
2  
  new TreeSet x;
3  
  if (l != null) for (O o : l)
4  
    x.add(callF(f, o));
5  
  ret x;
6  
}
7  
8  
static <A, B> TreeSet<B> lambdaMapLike mapToTreeSet(IF1<A, B> f, Iterable<A> l) {
9  
  new TreeSet<B> x;
10  
  if (l != null) for (o : l)
11  
    x.add(f.get(o));
12  
  ret x;
13  
}
14  
15  
static <A, B> TreeSet<B> lambdaMapLike mapToTreeSet(Iterable<A> l, IF1<A, B> f) {
16  
  ret mapToTreeSet(f, l);
17  
}

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: 203 / 300
Version history: 2 change(s)
Referenced in: [show references]