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

11
LINES

< > BotCompany Repo | #1029092 // iterateListWithIndex

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

Libraryless. Click here for Pure Java version (5100L/28K).

static <A> ItIt<Pair<Int, A>> iterateListWithIndex(Iterable<A> l, int startAt default 0) {
  ret iff(new O {
    Iterator it = iterator(l);
    int i = startAt;
    
    public O get() {
      if (!it.hasNext()) ret endMarker();
      ret pair(i++, it.next());
    }
  });
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1029092
Snippet name: iterateListWithIndex
Eternal ID of this version: #1029092/8
Text MD5: fe23756f0ff219404c18ba1f2e1138a3
Transpilation MD5: 215146ddd0215c89c1c5429baad9b637
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-08 05:32:19
Source code size: 284 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 276 / 393
Version history: 7 change(s)
Referenced in: [show references]