Example usage for java.util List stream

List of usage examples for java.util List stream

Introduction

In this page you can find the example usage for java.util List stream.

Prototype

default Stream<E> stream() 

Source Link

Document

Returns a sequential Stream with this collection as its source.

Usage

From source file:io.sqp.core.messages.RowDataMessage.java

public static RowDataMessage fromTypedData(List<SqpValue> data) {
    // use json format values instead of SqpValue objects itself!
    return new RowDataMessage(data.stream().map(d -> d.getJsonFormatValue()).collect(Collectors.toList()));
}

From source file:com.baidu.rigel.biplatform.tesseract.isservice.search.agg.AggregateCompute.java

public static List<SearchIndexResultRecord> distinct(List<SearchIndexResultRecord> dataList) {
    return dataList.stream().distinct().collect(Collectors.toList());
}

From source file:de.rnd7.libtvdb.util.EpisodeUtil.java

public static String toName(final List<EpisodeInfo> episodeInfos) {
    return episodeInfos.stream().map(EpisodeInfo::toString).collect(Collectors.joining(", "));
}

From source file:Main.java

/**
 * Converts the given list of Double objects into an array of primitive doubles.
 * /* w  w w . ja v  a 2 s  .  c  om*/
 * If the list is null or empty, an empty array will be returned
 * 
 * @param inputList List of Double object to be converted in a primitive array
 * @return
 */
public static double[] listToPrimitiveArray(List<Double> inputList) {

    if (isEmpty(inputList)) {
        return new double[0];
    } else {
        return inputList.stream().mapToDouble(Double::new).toArray();
    }
}

From source file:com.uber.hoodie.DataSourceUtils.java

public static void checkRequiredProperties(PropertiesConfiguration configuration, List<String> checkPropNames) {
    checkPropNames.stream().forEach(prop -> {
        if (!configuration.containsKey(prop)) {
            throw new HoodieNotSupportedException("Required property " + prop + " is missing");
        }//from w  ww. ja  v a2s.  co  m
    });
}

From source file:org.graylog2.indexer.cluster.jest.JestUtils.java

private static List<String> extractReasons(List<JsonObject> rootCauses) {
    return rootCauses.stream().map(rootCause -> asString(rootCause.get("reason"))).collect(Collectors.toList());
}

From source file:Main.java

static public <T> CompletableFuture<List<T>> all(List<CompletableFuture<T>> cf) {
    return CompletableFuture.allOf(cf.toArray(new CompletableFuture[cf.size()]))
            .thenApply(v -> cf.stream().map(CompletableFuture::join).collect(toList()));
}

From source file:Main.java

public static int sum(List<Integer> list) {

    if (list == null) {
        throw new IllegalArgumentException("Can't sum values for NULL list");
    }/*from   w w  w . ja v a 2  s .c o  m*/

    return list.stream().parallel().reduce(0, (sum, val) -> sum + val);

}

From source file:me.yanaga.winter.data.jpa.spring.config.metadata.EnableRepositoriesMetadata.java

public static EnableRepositoriesMetadata of(AnnotationMetadata annotationMetadata) {
    List<String> packageAttributes = getPackageAttributes(annotationMetadata);
    if (packageAttributes.stream().allMatch(l -> l.isEmpty())) {
        return new EnableRepositoriesMetadata(
                ImmutableList.of(obtainPackageName(annotationMetadata.getClassName())));
    }//from www.  j  a  v a 2s .c  o  m
    return new EnableRepositoriesMetadata(packageAttributes);
}

From source file:io.sqp.proxy.customtypes.CustomTypeMapper.java

private static boolean typeMatchesAnyKeyword(String type, List<String> keywords) {
    return keywords.stream().anyMatch(type::contains);
}