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

19
LINES

< > BotCompany Repo | #1035012 // concatMapToSet - map, then join sets. uses HashSet

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

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

1  
static <A, B, C extends Iterable<B>> Set<B> concatMapToSet(Iterable<A> l, IF1<A, C> f) {
2  
  new Set<B> set;
3  
  if (l != null)
4  
    for (a : l)
5  
      addAll(set, f.get(a));
6  
  ret set;
7  
}
8  
9  
static <A, B, C extends Iterable<B>> Set<B> lambdaMapLike concatMapToSet(IF1<A, C> f, Iterable<A> l) {
10  
  ret concatMapToSet(l, f);
11  
}
12  
13  
static <A, B, C extends Iterable<B>> Set<B> lambdaMapLike concatMapToSet(IF1<A, C> f, A[] l) {
14  
  new Set<B> set;
15  
  if (l != null)
16  
    for (a : l)
17  
      addAll(set, f.get(a));
18  
  ret set;
19  
}

Author comment

Began life as a copy of #1005492

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035012
Snippet name: concatMapToSet - map, then join sets. uses HashSet
Eternal ID of this version: #1035012/4
Text MD5: 1cda596bdd1712257459e13221502d7d
Transpilation MD5: f8ba8d72a7a6448f3b36c4fc7c7951bd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-22 23:08:42
Source code size: 522 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 59 / 102
Version history: 3 change(s)
Referenced in: [show references]