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

13
LINES

< > BotCompany Repo | #1005062 // collectUnique

JavaX fragment (include)

static HashSet collectUnique(Collection c, S field) {
  new HashSet set;
  for (O a : c) {
    O val = getOpt(a, field);
    if (val != null)
      set.add(val);
  }
  ret set;
}

static HashSet mapMethodLike collectUnique(S field, Collection c) {
  ret collectUnique(c, field);
}

Author comment

Began life as a copy of #1002504

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005062
Snippet name: collectUnique
Eternal ID of this version: #1005062/2
Text MD5: 98fde9ca6e26f9cbc5c4a5c5f9d30f35
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-17 00:12:33
Source code size: 292 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 545 / 570
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010787 - collectUniqueOrdered