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:opensnap.security.UserAdapter.java

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
    return this.user.getRoles().stream().map((r -> new SimpleGrantedAuthority(r))).collect(Collectors.toList());
}

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

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

From source file:com.hp.autonomy.hod.client.api.userstore.group.GroupInfo.java

private GroupInfo(final Builder builder) {
    name = builder.name;/*from www.  j a va 2 s  .  com*/
    userStore = builder.userStore;
    parents = builder.parents;
    children = builder.children;

    users = new LinkedList<>();

    users.addAll(builder.users.stream().map(GroupUser::getUuid).collect(Collectors.toList()));
}

From source file:am.ik.categolj2.domain.service.category.CategoryServiceImpl.java

@Override
public List<CategoryDto> findAll() {
    List<String> categoryStrings = categoryRepository.findAllConcatenatedCategory();
    return categoryStrings.stream().map(string -> new CategoryDto(Categories.fromCategory(string)))
            .collect(Collectors.toList());
}

From source file:org.iti.agrimarket.view.FileUploadController.java

public String provideUploadInfo(Model model) {
    File rootFolder = new File(
            "C:\\Users\\Amr\\Documents\\GP\\Agri_Market\\agrimarket_gp_iti\\AgriMarket_v2.2");
    List<String> fileNames = Arrays.stream(rootFolder.listFiles()).map(f -> f.getName())
            .collect(Collectors.toList());

    model.addAttribute("files",
            Arrays.stream(rootFolder.listFiles()).sorted(Comparator.comparingLong(f -> -1 * f.lastModified()))
                    .map(f -> f.getName()).collect(Collectors.toList()));

    return "uploadForm";
}

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

public static List<Device> device(HttpClient httpClient, CloudKitty kitty, Collection<String> deviceID)
        throws IOException {

    List<CloudKit.RecordRetrieveResponse> responses = kitty.recordRetrieveRequest(httpClient, "mbksync",
            deviceID);/*w  w  w.j  a  v a 2s .  co  m*/
    logger.debug("-- device() - responses: {}", responses);

    return responses.stream().map(CloudKit.RecordRetrieveResponse::getRecord).map(Devices::from)
            .collect(Collectors.toList());
}

From source file:com.hotmart.hot.uploader.model.FileMetaInfoRepository.java

public Collection<FileMetaInfo> findFileMetaInfo(String user) {
    return fileMetaInfoCache.entrySet().stream().filter(map -> user.equals(map.getValue().getUser()))
            .map(map -> map.getValue()).collect(Collectors.toList());

}

From source file:org.keycloak.connections.httpclient.ProxyMappings.java

/**
 * Creates a new  {@link ProxyMappings} from the provided {@code List} of proxy mapping strings.
 * <p>//from   w w  w  .ja  v a 2s  .  c  o  m
 *
 * @param proxyMappings
 */
public static ProxyMappings valueOf(List<String> proxyMappings) {

    if (proxyMappings == null || proxyMappings.isEmpty()) {
        return EMPTY_MAPPING;
    }

    List<ProxyMapping> entries = proxyMappings.stream() //
            .map(ProxyMapping::valueOf) //
            .collect(Collectors.toList());

    return new ProxyMappings(entries);
}

From source file:com.davidmogar.alsa.services.bus.internal.BusManagerServiceImpl.java

@Override
public List<BusDto> findAll() {
    return StreamSupport.stream(busDataService.findAll().spliterator(), false).map(BusDto::new)
            .collect(Collectors.toList());
}

From source file:com.tekstosense.opennlp.config.ModelLoaderConfig.java

/**
 * Gets the models./*from w w w . j av  a2  s .c o  m*/
 *
 * @return the models
 */
public static String[] getModels() {
    File dir = new File(Config.getConfiguration().getString(MODELPATH));

    LOG.info("Loading Models from... " + dir.getAbsolutePath());
    List<String> models = new ArrayList<>();
    String[] modelNames = getModelNames();

    List<String> wildCardPath = Arrays.stream(modelNames).map(model -> {
        return "en-ner-" + model + "*.bin";
    }).collect(Collectors.toList());

    FileFilter fileFilter = new WildcardFileFilter(wildCardPath, IOCase.INSENSITIVE);
    List<String> filePath = Arrays.asList(dir.listFiles(fileFilter)).stream()
            .map(file -> file.getAbsolutePath()).collect(Collectors.toList());
    return filePath.toArray(new String[filePath.size()]);
}