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

14
LINES

< > BotCompany Repo | #1034612 // uniquifyBy

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

Transpiled version (5009L) is out of date.

1  
static <A, B> L<A> lambdaMapLike uniquifyBy(IF1<A, B> f, Cl<A> l) {
2  
  if (l == null) null;
3  
  if (l(l) < 2) ret asList(l);
4  
  new HashSet<B> set;
5  
  new L<A> out;
6  
  for (A a : l)
7  
    if (set.add(f.get(a)))
8  
      out.add(a);
9  
  ret out;
10  
}
11  
12  
static <A, B> L<A> lambdaMapLike uniquifyBy(Cl<A> l, IF1<A, B> f) {
13  
  ret uniquifyBy(f, l);
14  
}

Author comment

Began life as a copy of #1006315

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034612
Snippet name: uniquifyBy
Eternal ID of this version: #1034612/3
Text MD5: a713d4b5855ebbeb3d0caeb900436909
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-11 19:46:23
Source code size: 337 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 281
Version history: 2 change(s)
Referenced in: [show references]