Stream empty() example
Description
Stream empty()
creates an empty sequential Stream.
Syntax
empty
has the following syntax.
static <T> Stream<T> empty()
Example
The following example shows how to use empty
.
import java.util.stream.Stream;
//from ww w . j a va 2 s . com
public class Main {
public static void main(String[] args) {
Stream<String> s = Stream.empty();
s.limit(10)
.forEach(System.out::println);
}
}