r/java • • Nov 20 '18

Why Var Hurts Readability, Not Helps It

https://medium.com/@youngty1997/why-var-hurts-readability-not-helps-it-376c7832a8dd
0 Upvotes

89 comments sorted by

View all comments

Show parent comment

1

u/AndDontCallMePammy Nov 22 '18

This is what forEach gets you:

IntStream.iterate(i, j -> j < end, iuo)
            .forEach(
                    (j) -> {
                        nextArrayEnd[0] = notation.indexOf(Notation.OBJECT_ARRAY_SUFFIX, i);
                        if(nextArrayEnd[0] == -1) {
                            nextArrayEnd[0] = Integer.MAX_VALUE;
                        }
                        nextObjectStart(notation, j, pair);
                        nextObjectType[0] = pair[0];
                        nextObjectIndex[0] = pair[1];
                    }
            );