Here you can find the source of mapElementsSizes(IntStream intStream)
public static int mapElementsSizes(IntStream intStream)
//package com.java2s; //License from project: Open Source License import java.util.OptionalInt; import java.util.stream.IntStream; public class Main { public static int mapElementsSizes(IntStream intStream) { OptionalInt n = intStream.reduce((a, b) -> (a == -1) ? -1 : (b == 1) ? a : (a == b) ? a : (a == 1) ? b : -1 // reduce() return -1 // no changes of a // no changes of a // change to b // change to -1 );//from www .ja v a2 s. c o m return n.isPresent() ? n.getAsInt() : 1; } }