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.

static <A, B> L<A> lambdaMapLike uniquifyBy(IF1<A, B> f, Cl<A> l) {
  if (l == null) null;
  if (l(l) < 2) ret asList(l);
  new HashSet<B> set;
  new L<A> out;
  for (A a : l)
    if (set.add(f.get(a)))
      out.add(a);
  ret out;
}

static <A, B> L<A> lambdaMapLike uniquifyBy(Cl<A> l, IF1<A, B> f) {
  ret uniquifyBy(f, l);
}

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