Java Code Examples for

Following code examples demonstrate how to use android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use various code implementation of this class.

    public static <E> Stream<E> reverseStream(Deque<E> linkedList) {
        final Spliterator<E> spliterator = Spliterators.spliteratorUnknownSize(linkedList.descendingIterator(), 0);
        return, false);

    public static void step1_stream(Iterable<String> things, PrintWriter writer) throws IOException {
        Stream<String> stream =, false);
        Iterable<String> iterable = stream::iterator;
        for (String thing : iterable) {

    public default void verifyGenericType()
    throws Exception {
        final Class<SUT> sut = createNewSUT();
        assertTrue("This j8unit test interface is used with a generic type that is illegaly not assignable to StreamSupport.class!",

    public static <T> Stream<List<T>> partition(Stream<T> stream, int size) {
        Iterable<List<T>> iterable = () -> Iterators.partition(stream.iterator(), size);
        return, false);

    public Optional<EntityMapper<? extends ExternalServiceResource, ? extends DiscoverableEntity>> find(ExternalServiceResource resource) {
        return, false)
            .filter(mapper -> mapper.canMap(resource))

    public static <T> Stream<T> of(Iterator<T> iterator) {
        Iterable<T> iterable = () -> iterator;
        return, false);

Low-level utility methods for creating and manipulating streams.

This class is mostly for

library writers presenting stream views of data structures; most static stream methods intended for end users are in the various Stream classes. @since 1.8

Read More