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

16
LINES

< > BotCompany Repo | #1028729 // mapToCIMultiSet - map function, return as CI multiset

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

Libraryless. Click here for Pure Java version (3039L/19K).

static <A> MultiSet<S> mapToCIMultiSet(IF1<A, S> f, Iterable<A> l) {
  ret mapToCIMultiSet((O) f, l);
}

static MultiSet<S> mapToCIMultiSet(O f, Iterable l) {
  MultiSet<S> x = ciMultiSet();
  if (l != null) for (O o : l) {
    S s = cast callF(f, o);
    if (s != null) x.add(s);
  }
  ret x;
}

static <A> MultiSet<S> mapToCIMultiSet(Iterable<A> l, IF1<A, S> f) {
  ret mapToCIMultiSet(f, l);
}

Author comment

Began life as a copy of #1018022

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028729
Snippet name: mapToCIMultiSet - map function, return as CI multiset
Eternal ID of this version: #1028729/3
Text MD5: 0ca79d846e53a719af2f2ff6203c620f
Transpilation MD5: 70a6740c9d53e7fa0ae7c660dec74f7b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-06 16:17:27
Source code size: 411 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 160 / 240
Version history: 2 change(s)
Referenced in: [show references]