Java Stream Operation arrayWrap(final Stream stream)

Here you can find the source of arrayWrap(final Stream stream)

Description

Produces array of stream's elements wrapped into arrays.

License

Open Source License

Declaration

public static Object[][] arrayWrap(final Stream<?> stream) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import static java.util.stream.Collectors.toList;
import java.util.stream.Stream;

public class Main {
    /**// w w  w .ja v  a  2 s  .c om
     * Produces array of stream's elements wrapped into arrays.
     */
    public static Object[][] arrayWrap(final Stream<?> stream) {
        return stream.map(s -> new Object[] { s }).collect(toList()).toArray(new Object[0][]);
    }
}

Related

  1. asList(Stream stream)
  2. buildInvalidArgsError(Stream values, Stream types)
  3. bytesToIntStream(byte[] bytes)
  4. cast(Stream stream, Class type)

  5. HOME | Copyright © www.java2s.com 2016