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.github.drbookings.ui.BookingsByOrigin.java

public Collection<T> getBookingBookings() {
    return bookingEntries.stream().filter(BOOKING_FILTER).collect(Collectors.toList());
}

From source file:de.bund.bfr.math.MultivariateOptimization.java

public static MultivariateOptimization createLodOptimizer(String formula, List<String> parameters,
        List<Double> targetValues, Map<String, List<Double>> variableValues, double levelOfDetection)
        throws ParseException {
    String sdParam = parameters.stream().collect(Collectors.joining());
    List<String> params = Stream.concat(parameters.stream(), Stream.of(sdParam)).collect(Collectors.toList());

    return new MultivariateOptimization(params, sdParam,
            new LodFunction(formula, params, variableValues, targetValues, levelOfDetection, sdParam));
}

From source file:cn.org.once.cstack.model.Module.java

public Module(Application application, Image image) {
    super(application, image);
    this.application = application;
    this.ports = image.getExposedPorts().entrySet().stream()
            .map(kv -> new Port(kv.getKey(), kv.getValue(), null, false, this)).collect(Collectors.toList());
    this.initialized = false;
}

From source file:fi.helsinki.opintoni.service.CourseService.java

public List<CourseDto> getStudentCourses(String studentNumber, Locale locale) {
    return oodiClient.getEnrollments(studentNumber).stream().map(c -> courseConverter.toDto(c, locale))
            .collect(Collectors.toList());
}

From source file:delfos.rs.contentbased.vsm.booleanvsm.SparseVector.java

public List<Pair<Key, Double>> entrySet() {
    return map.entrySet().stream().sorted((entry1, entry2) -> entry1.getKey().compareTo(entry2.getKey()))
            .map(entry -> new Pair<>(entry.getKey(), entry.getValue())).collect(Collectors.toList());
}

From source file:com.blackducksoftware.integration.hub.detect.workflow.report.OverviewSummarizer.java

private List<OverviewSummaryData> summarize(final Map<File, List<DetectorEvaluation>> byDirectory) {
    return byDirectory.entrySet().stream().flatMap(it -> createData(it.getKey().toString(), it.getValue()))
            .collect(Collectors.toList());
}

From source file:org.apache.nifi.minifi.c2.security.authorization.PrincipalStringAuthorityGranter.java

@Override
public Collection<GrantedAuthority> grantAuthorities(Authentication authentication) {
    List<String> authorities = grantedAuthorityMap.get(authentication.getPrincipal().toString());
    if (authorities == null) {
        return null;
    }//from   w w  w.  j  av a 2s  .  c  o  m
    return authorities.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList());
}

From source file:com.netflix.spinnaker.igor.jenkins.JenkinsCache.java

public List<String> getTypeaheadResults(String search) {
    List<String> results = new ArrayList<>();
    redisClientDelegate.withKeyScan(prefix() + ":*:*" + search.toUpperCase() + "*:*", 1000,
            page -> results.addAll(page.getResults().stream().map(JenkinsCache::extractTypeaheadResult)
                    .collect(Collectors.toList())));
    results.sort(Comparator.naturalOrder());
    return results;
}

From source file:de._692b8c32.cdlauncher.tasks.GoogleDownloadTask.java

@Override
public void doWork() {
    setProgress(-1);//w  w w  . j a va 2s  . c om

    try {
        HttpClient client = HttpClients.createDefault();
        String realUrl = null;
        Pattern pattern = Pattern.compile(
                "<a id=\"uc-download-link\" class=\"goog-inline-block jfk-button jfk-button-action\" href=\"([^\"]*)\">");
        try (BufferedReader reader = new BufferedReader(
                new InputStreamReader(client.execute(new HttpGet(fileUrl)).getEntity().getContent()))) {
            for (String line : reader.lines().collect(Collectors.toList())) {
                Matcher matcher = pattern.matcher(line);
                if (matcher.find()) {
                    realUrl = fileUrl.substring(0, fileUrl.lastIndexOf('/'))
                            + matcher.group(1).replace("&amp;", "&");
                    break;
                }
            }
        }

        if (realUrl == null) {
            throw new RuntimeException("Failed to find real url");
        } else {
            try (InputStream stream = client.execute(new HttpGet(realUrl)).getEntity().getContent()) {
                Files.copy(stream, cacheFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
            }
        }
    } catch (IOException ex) {
        throw new RuntimeException("Could not download data", ex);
    }
}