List of usage examples for java.util List stream
default Stream<E> stream()
From source file:com.ikanow.aleph2.data_model.utils.PropertiesUtils.java
/** Gets a merged set of configs * @param config_dir/*from w w w.ja v a 2s.c om*/ * @param default_config * @return */ public static Config getMergedConfig(final List<Config> config_files, final Config default_config) { final Config config = config_files.stream().reduce((cfg1, cfg2) -> cfg2.withFallback(cfg1)) .map(cfg -> cfg.withFallback(default_config)).orElseGet(() -> default_config); return config; }
From source file:de.metas.ui.web.view.json.JSONDocumentViewOrderBy.java
public static List<JSONDocumentViewOrderBy> ofList(final List<DocumentQueryOrderBy> orderBys) { if (orderBys == null || orderBys.isEmpty()) { return ImmutableList.of(); }//from w w w. j a va 2 s .c om return orderBys.stream().map(orderBy -> of(orderBy)).filter(jsonOrderBy -> jsonOrderBy != null) .collect(GuavaCollectors.toImmutableList()); }
From source file:BluemixUtils.java
private static int findMinSize(List<ClassifierUnit> all) { // return 270; return all.stream().map((ClassifierUnit s) -> s.getFolderWithImages()) .map((String s) -> new File(s).listFiles(filter).length).min(Integer::compare).get(); }
From source file:com.thinkbiganalytics.metadata.rest.jobrepo.nifi.NifiFeedProcessorStatsTransform.java
/** * Converts the domain model objects to the rest model equivalent * * @param domains A list of domain objects * @return a list of converted objects, or null if the provided list was empty *//*from www .j ava 2 s.c o m*/ public static List<NifiFeedProcessorStats> toModel( List<? extends com.thinkbiganalytics.metadata.api.jobrepo.nifi.NifiFeedProcessorStats> domains) { if (domains != null && !domains.isEmpty()) { return domains.stream().map(domain -> toModel(domain)).collect(Collectors.toList()); } return null; }
From source file:com.thinkbiganalytics.metadata.rest.jobrepo.nifi.NifiFeedProcessorStatsTransform.java
/** * Converts the domain model objects to the rest model equivalent * * @param domains A list of domain objects * @return a list of converted objects, or null if the provided list was empty *//* w w w. ja v a 2 s . co m*/ public static List<NifiFeedProcessorStatsErrors> toErrorsModel( List<? extends com.thinkbiganalytics.metadata.api.jobrepo.nifi.NifiFeedProcessorErrors> domains) { if (domains != null && !domains.isEmpty()) { return domains.stream().map(domain -> toErrorsModel(domain)).collect(Collectors.toList()); } return null; }
From source file:info.archinnov.achilles.internals.parser.UDFParser.java
public static void validateNoDuplicateDeclaration(AptUtils aptUtils, List<UDFSignature> signatures) { // Validate not declared many time using full equality for (UDFSignature signature : signatures) { signatures.stream().filter(signature::equals) //Equality by comparing name, keyspace, return types and param types .filter(x -> x != signature) //Identity comparison, exclude self .forEach(x -> aptUtils.printError( "Functions '%s' and '%s' have same signature. Duplicate function declaration is not allowed", signature, x));/*from w w w . j a v a 2 s .c o m*/ } }
From source file:com.khartec.waltz.service.capability_usage.CapabilityUsageService.java
private static CapabilityUsage classifyAppCapabilities(Node<Capability, Long> capNode, List<ApplicationCapability> appCapabilities, List<CapabilityRating> ratings) { return ImmutableCapabilityUsage.builder().capability(capNode.getData()) .usages(appCapabilities.stream().filter(ac -> ac.capabilityId() == capNode.getId()) .collect(Collectors.toList())) .ratings(ratings.stream().filter(r -> r.capabilityId() == capNode.getId()) .collect(Collectors.toList())) .children(capNode.getChildren().stream() .map(n -> classifyAppCapabilities(n, appCapabilities, ratings)) .collect(Collectors.toList())) .build();/* w w w .jav a 2 s .c o m*/ }
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);//from w ww . j av a 2 s. c o m logger.debug("-- device() - responses: {}", responses); return responses.stream().map(CloudKit.RecordRetrieveResponse::getRecord).map(Devices::from) .collect(Collectors.toList()); }
From source file:com.khartec.waltz.jobs.sample.BusinessRegionProductHierarchyGenerator.java
private static Set<String> readRegions() throws IOException { List<String> lines = readLines(OrgUnitGenerator.class.getResourceAsStream("/regions.csv")); Map<String, Map<String, Set<String>>> regionHierarchy = lines.stream().skip(1) .map(line -> StringUtils.splitPreserveAllTokens(line, ",")) .filter(cells -> notEmpty(cells[0]) && notEmpty(cells[6]) && notEmpty(cells[5])) .map(cells -> Tuple.tuple(cells[0], cells[6], cells[5])) .collect(groupingBy(t -> t.v3, groupingBy(t -> t.v2, mapping(t -> t.v1, toSet())))); return regionHierarchy.keySet(); }
From source file:com.epam.dlab.automation.helper.WaitForStatus.java
private static String getNotebookStatus(JsonPath json, String notebookName) { List<Map<String, String>> notebooks = json.getList(EXPLORATORY_PATH); return notebooks.stream().filter(exploratoryNamePredicate(notebookName)).map(e -> e.get("status")).findAny() .orElse(StringUtils.EMPTY);/*from w ww . jav a2s . co m*/ }