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

21
LINES

< > BotCompany Repo | #1036114 // CloseableMapI - mapping iterator with closing

JavaX fragment (include)

sclass CloseableMapI<A, B> extends CloseableItIt<B> {
  IF1<A, B> f;
  Iterator<A> it;
  
  *(IF1<A, B> *f, Iterator<A> *it) {}
  
  public bool hasNext() {
    ret it.hasNext();
  }
  
  public B next() {
    ret f.get(it.next());
  }
  
  close {
    if (it cast AutoCloseable) {
      it.close();
      it = null;
    }
  }
}

Author comment

Began life as a copy of #1035103

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036114
Snippet name: CloseableMapI - mapping iterator with closing
Eternal ID of this version: #1036114/1
Text MD5: 068ac55d1341e64e8f83c8817b7dd0a6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-21 18:26:28
Source code size: 350 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 4 / 6
Referenced in: [show references]