Libraryless. Click here for Pure Java version (3864L/22K).
1 | static <A> int indexOfDifference(Iterable<A> i1, Iterable<A> i2) { |
2 | var it1 = iterator(i1); |
3 | var it2 = iterator(i2); |
4 | int i = 0; |
5 | while ping (true) { |
6 | bool a = it1.hasNext(), b = it2.hasNext(); |
7 | if (a != b) |
8 | ret i; |
9 | if (!a) |
10 | ret -1; |
11 | A el1 = it1.next(); |
12 | A el2 = it2.next(); |
13 | if (!eq(el1, el2)) |
14 | ret i; |
15 | ++i; |
16 | } |
17 | } |
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: | 159 / 207 |
Referenced in: | [show references] |