int (int ys, @NotNull Queue<? extends PositionedStripe> ends, @NotNull List<PositionedStripe> stripes, @NotNull Graphics g, int yStart) { while (!ends.isEmpty()) { PositionedStripe endingStripe = ends.peek(); if (endingStripe == null || endingStripe.yEnd > ys) break; ends.remove(); // check whether endingStripe got obscured in the range yStart...endingStripe.yEnd int i = stripes.indexOf(endingStripe); stripes.remove(i); if (i == 0) { // visible drawSpot(g, endingStripe.thin, yStart, endingStripe.yEnd, endingStripe.color); yStart = endingStripe.yEnd; } } return yStart; }