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).

1  
static <A> MultiSet<S> mapToCIMultiSet(IF1<A, S> f, Iterable<A> l) {
2  
  ret mapToCIMultiSet((O) f, l);
3  
}
4  
5  
static MultiSet<S> mapToCIMultiSet(O f, Iterable l) {
6  
  MultiSet<S> x = ciMultiSet();
7  
  if (l != null) for (O o : l) {
8  
    S s = cast callF(f, o);
9  
    if (s != null) x.add(s);
10  
  }
11  
  ret x;
12  
}
13  
14  
static <A> MultiSet<S> mapToCIMultiSet(Iterable<A> l, IF1<A, S> f) {
15  
  ret mapToCIMultiSet(f, l);
16  
}

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