Here you can find the source of firstValue(Stream
public final static <T> T firstValue(Stream<T> stream)
//package com.java2s; //License from project: Apache License import java.util.stream.Stream; public class Main { public final static <T> T firstValue(Stream<T> stream) { return stream.findAny().get(); }// ww w .j a v a2 s . com }