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

17
LINES

< > BotCompany Repo | #1033012 // indexOfDifference

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

Libraryless. Click here for Pure Java version (3864L/22K).

static <A> int indexOfDifference(Iterable<A> i1, Iterable<A> i2) {
  var it1 = iterator(i1);
  var it2 = iterator(i2);
  int i = 0;
  while ping (true) {
    bool a = it1.hasNext(), b = it2.hasNext();
    if (a != b)
      ret i;
    if (!a)
      ret -1;
    A el1 = it1.next();
    A el2 = it2.next();
    if (!eq(el1, el2))
      ret i;
    ++i;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033012
Snippet name: indexOfDifference
Eternal ID of this version: #1033012/1
Text MD5: 4c2e92241424c18422f77d15b6b27384
Transpilation MD5: 54f0d39ecb0538cd1c53d7fc8a725b10
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-11 10:42:45
Source code size: 370 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 204
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)