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

8
LINES

< > BotCompany Repo | #1023518 // singletonIterator

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1503L/10K).

static <A> ItIt<A> singletonIterator(A a) {
  ret new ItIt<A> {
    bool returned;
    
    public A next() { if (!returned) ret a with returned = true; else fail(); }
    public bool hasNext() { ret !returned; }
  };
}

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: #1023518
Snippet name: singletonIterator
Eternal ID of this version: #1023518/4
Text MD5: 8a9df9c009152f9570502a12e40e8331
Transpilation MD5: 6105955631e45e2e4490c21b96c893c2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-26 18:23:01
Source code size: 226 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 285
Version history: 3 change(s)
Referenced in: [show references]