Example usage for java.util.stream Collectors toList

List of usage examples for java.util.stream Collectors toList

Introduction

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

Prototype

public static <T> Collector<T, ?, List<T>> toList() 

Source Link

Document

Returns a Collector that accumulates the input elements into a new List .

Usage

From source file:uk.ac.ebi.ep.data.repositories.EnzymePortalEcNumbersRepositoryImpl.java

@Transactional(readOnly = true)
@Override// www  .  j  av a  2 s.c  o m
public List<String> findAccessionsByEc(String ecNumber) {
    JPAQuery query = new JPAQuery(entityManager);

    List<String> enzymes = query.from($).where($.ecNumber.equalsIgnoreCase(ecNumber))
            .list($.uniprotAccession.accession);

    return enzymes.stream().collect(Collectors.toList());
}

From source file:org.hyperledger.examples.dropwizard.TransactionRepresentation.java

public static TransactionRepresentation create(APITransaction tx, List<String> inputAddresses,
        List<String> color, List<Long> quantity) {
    List<InputRepresentation> inputRepresentations = new ArrayList<>(inputAddresses.size());
    int i = 0;/*ww  w  .ja v  a2s . com*/
    for (TransactionInput input : tx.getInputs()) {
        inputRepresentations
                .add(InputRepresentation.create(input, inputAddresses.get(i), color.get(i), quantity.get(i)));
        i++;
    }

    return new TransactionRepresentation(tx.getID(), tx.getBlockID(), tx.getVersion(), tx.getOutputs().stream()
            .map(OutputRepresentation::create).filter(o -> o.quantity != 0L).collect(Collectors.toList()),
            inputRepresentations);
}

From source file:br.edu.ifpb.bdnc.db4o.crud.dao.Dao.java

@Override
public synchronized List<T> findAll(Class<T> clazz) {
    ObjectContainer db = Db4oFactory.newInstance();
    List<T> list = null;/*from   w w w  .jav a 2  s . com*/
    try {
        ObjectSet<T> set = db.query(clazz);
        list = set.stream().collect(Collectors.toList());
    } finally {
        db.close();
    }
    return list;
}

From source file:io.kamax.mxisd.profile.ProfileManager.java

public <T> List<T> get(Function<ProfileProvider, List<T>> function) {
    return providers.stream().map(function).flatMap(Collection::stream).collect(Collectors.toList());
}

From source file:com.tpatterson.playground.work.FindAccounts.java

@Test
public void findMissingAccounts() throws Exception {
    String token = "eG5Finos1mLAavMcxwps8RDMYIDesBCC";

    // Fairplay - they are the same user creds
    // LWS - they are the same user creds
    // ACLS - Adobe Cloud License Service - just calls GLR no direct key access, although 2 different users
    // PLayReady - same user
    // Widevine/*from   w  w  w .j  a v  a2  s. co m*/
    String sea1User = "https://identity.auth.theplatform.com/idm/data/User/service/2686907";
    String phl1User = "https://identity.auth.theplatform.com/idm/data/User/service/2686892";

    QueryResult sea1Keys = getQueryResult(buildUserKeysQuery(sea1User, token));
    QueryResult phl1Keys = getQueryResult(buildUserKeysQuery(phl1User, token));

    List<DataObject> missingKeys = sea1Keys.getEntries().stream()
            .filter(dataObject -> !phl1Keys.getEntries().contains(dataObject)).collect(Collectors.toList());

    System.out.println("PHL1 missing UserKey accounts: " + missingKeys.size());
    for (DataObject missingKey : missingKeys) {
        DataObject account = getDataObject(buildAccountGetFor(missingKey, token));
        System.out.println("Clone: " + missingKey.getId() + " to Account: " + missingKey.getOwnerId() + " ("
                + account.getTitle() + ")");
    }
}

From source file:eu.mihosoft.vrl.v3d.Edge.java

public static List<Vector3d> toPoints(List<Edge> edges) {
    return edges.stream().map(e -> e.p1.pos).collect(Collectors.toList());
}

From source file:com.infinitechaos.vpcviewer.web.rest.dto.SubnetDetailDTO.java

public SubnetDetailDTO(final Subnet subnet, final RouteTable routeTable) {
    super(subnet);

    routeTableId = routeTable.getRouteTableId();
    routes.addAll(routeTable.getRoutes().stream().map(RouteDTO::new).collect(Collectors.toList()));
}

From source file:com.netflix.spinnaker.echo.artifacts.ArtifactExtractor.java

public List<Artifact> extractArtifacts(String type, String source, Map payload) {
    return artifactExtractors.stream().filter(p -> p.handles(type, source))
            .map(e -> e.getArtifacts(source, payload)).flatMap(Collection::stream).collect(Collectors.toList());
}

From source file:com.netflix.spinnaker.clouddriver.kubernetes.provider.KubernetesModelUtil.java

private static boolean someUpRemainingUnknown(List<Map<String, String>> healthsList) {
    List<Map<String, String>> knownHealthList = healthsList.stream()
            .filter(h -> !stateEquals(h, HealthState.Unknown)).collect(Collectors.toList());

    return !knownHealthList.isEmpty() && knownHealthList.stream().allMatch(h -> stateEquals(h, HealthState.Up));
}

From source file:com.galenframework.rainbow4j.colorscheme.GradientColorClassifier.java

public GradientColorClassifier(String name, List<Color> colors) {
    this.name = name;
    this.colors = colors.stream().map(c -> new Integer[] { c.getRed(), c.getGreen(), c.getBlue() })
            .collect(Collectors.toList()).toArray(new Integer[][] {});
}