$ java CustomGatherer (JDK 25) dedupeConsecutive of a,a,b,b,b,a,c,c = [a, b, a, c] CHECK ok : consecutive runs collapse to [a, b, a, c]; the second 'a' survives because it isn't adjacent to the first takeUntil(n == 3) result = [1, 2, 3], upstream elements actually pulled = [1, 2, 3] CHECK ok : takeUntil includes the element that satisfies the stop condition: [1, 2, 3] CHECK ok : the upstream peek() only saw 1, 2, 3 -- elements 4, 5, 6 were never pulled, this genuinely short-circuits exit=0