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:gov.ca.cwds.cals.util.PlacementHomeUtil.java

/**
 * Overloaded method for composing facility name according to applicants list.
 *
 * @param applicantsList applicants list
 * @return facility name//ww w  . j  av a  2  s  .c o m
 */
public static String composeFacilityNameByApplicantsList(List<RFA1aApplicant> applicantsList) {
    return composeFacilityName(
            applicantsList.stream().map(RFA1aFormMapper.INSTANCE::toApplicantDTO).collect(Collectors.toList()));
}

From source file:com.github.horrorho.liquiddonkey.cloud.data.Snapshots.java

public static final Snapshot from(Snapshot snapshot, Predicate<ICloud.MBSFile> predicate) {
    List<ICloud.MBSFile> filtered = snapshot.files().stream().filter(predicate).collect(Collectors.toList());
    return new Snapshot(snapshot, filtered);
}

From source file:com.netflix.metacat.common.server.properties.PropertyUtils.java

/**
 * Convert a delimited string into a List of {@code QualifiedName}.
 *
 * @param names     The list of names to split
 * @param delimiter The delimiter to use for splitting
 * @return The list of qualified names//from   w  w w. j  a  v  a2 s.c o m
 */
static List<QualifiedName> delimitedStringsToQualifiedNamesList(@Nonnull @NonNull final String names,
        final char delimiter) {
    if (StringUtils.isNotBlank(names)) {
        return Splitter.on(delimiter).omitEmptyStrings().splitToList(names).stream()
                .map(QualifiedName::fromString).collect(Collectors.toList());
    } else {
        return Lists.newArrayList();
    }
}

From source file:com.evolveum.midpoint.model.api.util.DeputyUtils.java

@NotNull
public static Collection<String> getDelegatorOids(@NotNull UserType user) {
    return getDelegatorReferences(user).stream().map(PrismReferenceValue::getOid).collect(Collectors.toList());
}

From source file:com.synopsys.integration.util.EnumUtils.java

public static <T extends Enum<T>> List<T> convert(List<String> values, Class<T> enumClass) {
    return values.stream().map(String::trim).filter(StringUtils::isNotBlank)
            .map(token -> Enum.valueOf(enumClass, token)).collect(Collectors.toList());
}

From source file:org.ow2.proactive.workflow_catalog.rest.dto.Variable.java

public static List<Variable> to(
        Collection<? extends org.ow2.proactive.workflow_catalog.rest.entity.Variable> from) {
    return from.stream().map(entity -> new Variable(entity.getKey(), entity.getValue()))
            .collect(Collectors.toList());
}

From source file:com.pablinchapin.planz.dailytaskmanager.service.TaskService.java

public List<TaskServiceDTO> findAll() {
    return repository.findAll().stream()
            .map(entity -> new TaskServiceDTO(entity.getId(), entity.getDescription(), entity.isCompleted()))
            .collect(Collectors.toList());
}

From source file:com.thoughtworks.go.config.rules.SupportedEntity.java

public static List<String> unmodifiableListOf(SupportedEntity... supportedEntities) {
    return unmodifiableList(
            Arrays.stream(supportedEntities).map(SupportedEntity::getType).collect(Collectors.toList()));
}

From source file:io.wcm.devops.conga.generator.util.EnvironmentExpander.java

/**
 * Environment definitions allows definition of nodes with multiple node names.
 * Expand them to nodes with single node names to simplify further processing.
 * @param environment Environment that may contain nodes with multiple node names.
 * @param environmentName Environment name
 * @return Environment that contains only nodes with single node names
 *///from  w  ww  . j  a  va2s .  co  m
public static Environment expandNodes(Environment environment, String environmentName) {
    Environment clonedEnvironemnt = new Cloner().deepClone(environment);

    clonedEnvironemnt.setNodes(environment.getNodes().stream()
            .flatMap(node -> getSingleNodes(node, environmentName)).collect(Collectors.toList()));

    return clonedEnvironemnt;
}

From source file:cfd.backupper.state.StartupConfig.java

public static void putSetting(String key, List l) {

    //l needs to be toString(), otherwise there are no doublequotes in JSON.
    List stringedList = (List) l.stream().map(elem -> elem.toString()).collect(Collectors.toList());
    if (jo.containsKey(key)) {
        jo.replace(key, stringedList);/*from  ww  w  .  j  a  va2  s .c  o m*/
    } else {
        jo.put(key, stringedList);
    }
    try {
        FileWriter fw = new FileWriter(confFile, false);
        fw.append(jo.toJSONString());
        fw.flush();
        fw.close();
    } catch (IOException ex) {
        Logger.getLogger(StartupConfig.class.getName()).log(Level.SEVERE, null, ex);
    }
}