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:com.wormsim.utils.TrackedScalar.java

public static double calcBetweenVarianceA(List<List<Double>> data) {
    double psi__ = data.stream().mapToDouble((arr) -> arr.stream().mapToDouble((d) -> d).sum() / (arr.size()))
            .sum() / (data.size());//w  ww. j  a v a2 s.  com
    double result = data.stream().mapToDouble(
            (arr) -> pow(arr.stream().mapToDouble((d) -> d).sum() / (arr.size()) - psi__, 2) * arr.size()).sum()
            / (data.size() - 1);
    System.out.println("Between Variance A = " + result);
    return result;
}

From source file:com.wormsim.utils.TrackedScalar.java

public static double calcWithinVarianceA(List<List<Double>> data) {
    double result = data.stream().mapToDouble((arr) -> {
        final double psi_m = arr.stream().mapToDouble((d) -> d).sum() / (arr.size());
        return arr.stream().mapToDouble((d) -> pow(d - psi_m, 2)).sum() / (arr.size() - 1);
    }).sum() / (data.size());/* w ww .java 2  s  .  co m*/
    System.out.println("Within Variance A = " + result);
    return result;
}

From source file:com.wormsim.utils.TrackedScalar.java

public static double calcWithinVarianceB(List<List<Double>> data) {
    double result = data.stream().mapToDouble((arr) -> {
        final double psi_m = arr.stream().mapToDouble((d) -> d / (arr.size())).sum();
        return arr.stream().mapToDouble((d) -> pow(d - psi_m, 2) / (arr.size() - 1)).sum() / (data.size());
    }).sum();/*  w  w  w. j  a v a 2s .  c  om*/
    System.out.println("Within Variance B = " + result);
    return result;
}

From source file:com.astamuse.asta4d.web.form.flow.ext.ExcludingFieldRetrievableFormHelper.java

public static final String[] retrieveExcludingFieldsByIncluding(Class<?> cls, String... includingFields) {
    List<AnnotatedPropertyInfo> props = AnnotatedPropertyUtil.retrieveProperties(cls);
    return props.stream().filter(p -> !ArrayUtils.contains(includingFields, p.getName())).map(p -> p.getName())
            .toArray(size -> {// www  .ja v a  2 s .c  om
                return new String[size];
            });
}

From source file:com.wormsim.utils.TrackedScalar.java

public static double calcBetweenVarianceB(List<List<Double>> data) {
    double psi__ = data.stream()
            .mapToDouble((arr) -> arr.stream().mapToDouble((d) -> d / (arr.size())).sum() / (data.size()))
            .sum();/*from w w w  . j  a v a  2  s. c o m*/
    double result = data.stream()
            .mapToDouble((arr) -> pow(arr.stream().mapToDouble((d) -> d).sum() / (arr.size()) - psi__, 2)
                    * arr.size() / (data.size() - 1))
            .sum();
    System.out.println("Between Variance B = " + result);
    return result;
}

From source file:com.ixortalk.aws.cognito.boot.filter.AwsCognitoIdTokenProcessor.java

private static <T, U> List<U> convertList(List<T> from, Function<T, U> func) {
    return from.stream().map(func).collect(Collectors.toList());
}

From source file:com.thoughtworks.go.config.CaseInsensitiveString.java

public static List<CaseInsensitiveString> list(List<String> strings) {
    return toList(strings.stream());
}

From source file:com.github.horrorho.inflatabledonkey.cloud.clients.MBKSyncClient.java

static List<CloudKit.ProtectionInfo> zone(List<CloudKit.ZoneRetrieveResponse> response, ProtectionZone zone) {
    return response.stream().map(CloudKit.ZoneRetrieveResponse::getZoneSummarysList).flatMap(Collection::stream)
            .filter(CloudKit.ZoneRetrieveResponseZoneSummary::hasTargetZone)
            .map(CloudKit.ZoneRetrieveResponseZoneSummary::getTargetZone)
            .filter(CloudKit.Zone::hasProtectionInfo).map(CloudKit.Zone::getProtectionInfo)
            .collect(Collectors.toList());
}

From source file:com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesKind.java

public static List<KubernetesKind> fromStringList(List<String> names) {
    return names.stream().map(KubernetesKind::fromString).collect(Collectors.toList());
}

From source file:com.u2apple.tool.util.StaticMapFileUtils.java

private static void sortModels(List<VID> vids, Set<String> changedVids) {
    vids.stream().filter((vid) -> (changedVids.contains(vid.getValue()))).forEach((vid) -> {
        sortModels(vid);/* www. j  a  v a  2  s. com*/
    });
}