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

37
LINES

< > BotCompany Repo | #1022048 // mapI_pcall - apply a function to an iterator, use pcall

JavaX fragment (include)

1  
static IterableIterator mapLike mapI_pcall(final O f, final Iterator i) {
2  
  ret new IterableIterator {
3  
    public bool hasNext() {
4  
      ret i.hasNext();
5  
    }
6  
    
7  
    public O next() {
8  
      ret pcallF(f, i.next());
9  
    }
10  
  };
11  
}
12  
13  
ifclass IterableIterator
14  
static IterableIterator mapI_pcall(IterableIterator i, O f) {
15  
  ret mapI_pcall((Iterator) i, f);
16  
}
17  
18  
static IterableIterator mapI_pcall(O f, IterableIterator i) {
19  
  ret mapI_pcall((Iterator) i, f);
20  
}
21  
endif
22  
23  
static IterableIterator mapI_pcall(Iterator i, O f) {
24  
  ret mapI_pcall(f, i);
25  
}
26  
27  
static <A, B> ItIt<B> mapI_pcall(Iterable<A> i, IF1<A, B> f) {
28  
  ret mapI_pcall(i, (O) f);
29  
}
30  
31  
static IterableIterator mapI_pcall(Iterable i, O f) {
32  
  ret mapI_pcall(f, i.iterator());
33  
}
34  
35  
static IterableIterator mapI_pcall(O f, Iterable i) {
36  
  ret mapI_pcall(i, f);
37  
}

Author comment

Began life as a copy of #1004292

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022048
Snippet name: mapI_pcall - apply a function to an iterator, use pcall
Eternal ID of this version: #1022048/1
Text MD5: c343df43101a63b0865d9d8e4aa9803b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-06 00:54:26
Source code size: 847 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 219
Referenced in: [show references]