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

5
LINES

< > BotCompany Repo | #1010215 // getIterator - convert object to iterator [fails if not convertible]

JavaX fragment (include)

1  
static Iterator getIterator(O o) {
2  
  if (o instanceof Iterator) ret (Iterator) o;
3  
  if (o instanceof Iterable) ret ((Iterable) o).iterator();
4  
  fail("Can't convert to iterator: " + className(o));
5  
}

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: #1010215
Snippet name: getIterator - convert object to iterator [fails if not convertible]
Eternal ID of this version: #1010215/3
Text MD5: 1753da66de13c5f377a0ff3584e65dcb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-06 20:34:51
Source code size: 201 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 519 / 510
Version history: 2 change(s)
Referenced in: [show references]