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:com.fluke.database.dataservice.IntraDayDao.java

public void insertRealtimeData(IntradayDetails data) {

    String id = data.getMeta().getId().toUpperCase();
    Timestamp time = new ReatimeDBReader().getLastTimeStamp(id);
    try {/*from w  w w . j  ava2  s  .c o m*/
        if (time == null) {
            addRealtimeValues(runner, data.getSeries(), id);
        } else {
            addRealtimeValues(runner, data.getSeries().stream().filter(d -> d.getTimestamp().after(time))
                    .collect(Collectors.toList()), id);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}

From source file:org.createnet.raptor.auth.service.acl.RaptorPermission.java

public static List<String> toLabel(List<Permission> p) {
    return p.stream().map(RaptorPermission::toLabel).collect(Collectors.toList());
}

From source file:com.thinkbiganalytics.common.velocity.service.InMemoryVelocityTemplateProvider.java

@Override
public List<? extends VelocityTemplate> findByType(String type) {
    return map.values().stream().filter(t -> t.getType().equalsIgnoreCase(type)).collect(Collectors.toList());
}

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

@Override
public List<CategoryDto> search(String keyword) {
    String categoryName = QueryEscapeUtils.toContainingCondition(keyword);
    List<String> categoryStrings = categoryRepository.findConcatenatedCategoryLikeCategoryName(categoryName);
    return categoryStrings.stream().map(string -> new CategoryDto(Categories.fromCategory(string)))
            .collect(Collectors.toList());
}

From source file:se.uu.it.cs.recsys.semantic.config.ComputingDomainReasonerSpringConfig.java

@Bean
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();

    GuavaCache fpTreeCache = new GuavaCache("ComputingDomainCache",
            CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS).maximumSize(100).build());

    cacheManager.setCaches(Stream.of(fpTreeCache).collect(Collectors.toList()));

    return cacheManager;
}

From source file:io.github.swagger2markup.internal.component.ConsumesComponent.java

@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) {
    markupDocBuilder.sectionTitleLevel(params.titleLevel, labels.getLabel(Labels.CONSUMES));
    markupDocBuilder.unorderedList(params.consumes.stream().map(value -> literalText(markupDocBuilder, value))
            .collect(Collectors.toList()));
    return markupDocBuilder;
}

From source file:io.github.swagger2markup.internal.component.ProducesComponent.java

@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) {
    markupDocBuilder.sectionTitleLevel(params.titleLevel, labels.getLabel(Labels.PRODUCES));
    markupDocBuilder.unorderedList(params.produces.stream().map(value -> literalText(markupDocBuilder, value))
            .collect(Collectors.toList()));
    return markupDocBuilder;
}

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

public static List<Asset> assets(HttpClient httpClient, CloudKitty kitty, ProtectionZone zone,
        Collection<String> fileList) throws IOException {

    List<String> nonEmptyFileList = fileList.stream().filter(Assets::isNonEmpty).collect(Collectors.toList());
    logger.debug("-- assets() - non-empty file list size: {}", nonEmptyFileList.size());

    if (nonEmptyFileList.isEmpty()) {
        return new ArrayList<>();
    }/*from  w w w  .j  a v  a  2  s  .  c om*/

    List<CloudKit.RecordRetrieveResponse> responses = kitty.recordRetrieveRequest(httpClient, "_defaultZone",
            nonEmptyFileList);

    return responses.stream().filter(CloudKit.RecordRetrieveResponse::hasRecord)
            .map(CloudKit.RecordRetrieveResponse::getRecord).map(r -> asset(r, zone))
            .filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
}

From source file:com.thoughtworks.go.spark.SparkController.java

default String controllerPath(Map<String, String> params) {
    if (params == null || params.isEmpty()) {
        return controllerBasePath();
    } else {/*from w  ww  .ja  v a 2 s  . c om*/
        List<BasicNameValuePair> queryParams = params.entrySet().stream()
                .map(entry -> new BasicNameValuePair(entry.getKey(), entry.getValue()))
                .collect(Collectors.toList());
        return controllerBasePath() + '?' + URLEncodedUtils.format(queryParams, "utf-8");
    }
}

From source file:it.reply.orchestrator.controller.ControllerTestUtils.java

public static List<Deployment> createDeployments(int total, boolean sorted) {
    List<Deployment> deployments = Lists.newArrayList();
    for (int i = 0; i < total; ++i) {
        deployments.add(createDeployment());
    }/*ww  w.j a  v a2  s . c  o  m*/
    if (sorted) {
        deployments.stream().sorted(new Comparator<Deployment>() {

            @Override
            public int compare(Deployment o1, Deployment o2) {
                return o1.getCreated().compareTo(o2.getCreated());
            }
        }).collect(Collectors.toList());
    }
    return deployments;
}