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

40
LINES

< > BotCompany Repo | #1029019 // mapI_nonNulls_if1

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

Libraryless. Click here for Pure Java version (2521L/16K).

static <A, B> ItIt<B> mapI_nonNulls_if1(Iterable<A> i, IF1<A, B> f) {
  ret mapI_nonNulls_if1(f, i);
}

static <A, B> ItIt<B> mapI_nonNulls_if1(IF1<A, B> f, Iterable<A> i) {
  ret i == null ? null : mapI_nonNulls_if1(f, i.iterator());
}

static <A, B> ItIt<B> mapI_nonNulls_if1(IF1<A, B> f, Iterator<A> i) {
  if (i == null) null;
  class I extends ItIt<B> {
    B a;
    bool done;
    
    public bool hasNext() {
      getNext();
      ret !done;
    }
    
    public B next() {
      getNext();
      if (done) fail();
      B _a = a;
      a = null;
      ret _a;
    }
    
    void getNext() {
      if (done || a != null) ret;
      while ping (true) {
        if (!i.hasNext())
          ret with done = true;
        B _a = f.get(i.next());
        if (_a != null)
          ret with a = _a;
      }
    }
  };
  ret new I;
}

Author comment

Began life as a copy of #1004292

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: #1029019
Snippet name: mapI_nonNulls_if1
Eternal ID of this version: #1029019/6
Text MD5: 6351c36f3bd1d763fa26ab25b47dfebb
Transpilation MD5: 69d3df6c45d5f1f356aac2bf6bce7305
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-16 23:12:49
Source code size: 875 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 230
Version history: 5 change(s)
Referenced in: [show references]