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)

static IterableIterator mapLike mapI_pcall(final O f, final Iterator i) {
  ret new IterableIterator {
    public bool hasNext() {
      ret i.hasNext();
    }
    
    public O next() {
      ret pcallF(f, i.next());
    }
  };
}

ifclass IterableIterator
static IterableIterator mapI_pcall(IterableIterator i, O f) {
  ret mapI_pcall((Iterator) i, f);
}

static IterableIterator mapI_pcall(O f, IterableIterator i) {
  ret mapI_pcall((Iterator) i, f);
}
endif

static IterableIterator mapI_pcall(Iterator i, O f) {
  ret mapI_pcall(f, i);
}

static <A, B> ItIt<B> mapI_pcall(Iterable<A> i, IF1<A, B> f) {
  ret mapI_pcall(i, (O) f);
}

static IterableIterator mapI_pcall(Iterable i, O f) {
  ret mapI_pcall(f, i.iterator());
}

static IterableIterator mapI_pcall(O f, Iterable i) {
  ret mapI_pcall(i, f);
}

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: 269 / 292
Referenced in: [show references]