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

11
LINES

< > BotCompany Repo | #1014178 // iterableIterator - convert Iterator or Collection to IterableIterator

JavaX fragment (include)

static <A> IterableIterator<A> iterableIterator(final Iterator<A> it) {
  ret it == null ? null : new IterableIterator<A> {
    public bool hasNext() { ret it.hasNext(); }
    public A next() { ret it.next(); }
    public void remove() { it.remove(); }
  };
}

static <A> IterableIterator<A> iterableIterator(final Collection<A> it) {
  ret iterableIterator(iterator(it));
}

Author comment

Began life as a copy of #1011464

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014178
Snippet name: iterableIterator - convert Iterator or Collection to IterableIterator
Eternal ID of this version: #1014178/4
Text MD5: 42a7711d9a8797d70f05fb6827c372aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-25 21:00:06
Source code size: 384 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 360 / 399
Version history: 3 change(s)
Referenced in: [show references]