List of usage examples for java.util Collection stream
default Stream<E> stream()
From source file:io.cloudslang.web.services.FlowsServiceImpl.java
@Override @Cacheable//from w w w. ja v a 2 s.c o m public TreeMap<String, FlowVo> getFlows(String classpath) { Collection<File> cpFiles = getCpFiles(classpath); Map<String, FlowVo> flows = cpFiles.stream().map(this::fileToFlowVo) .collect(toMap(FlowVo::getId, Function.identity())); return new TreeMap<>(flows); }
From source file:com.netflix.subtitles.ttml.TtmlParagraphResolver.java
private List<Serializable> mergeContent(Collection<PEltype> pEls) { return pEls.stream().flatMap(p -> p.getContent().stream()).collect(Collectors.toList()); }
From source file:com.github.horrorho.inflatabledonkey.KeyBagManager.java
Set<String> keyBagUUIDs(Collection<Asset> assets) { return assets.stream().map(Asset::encryptionKey).map(key -> key.flatMap(FileKeyAssistant::uuid)) .filter(Optional::isPresent).map(Optional::get) .map(uuid -> Base64.getEncoder().encodeToString(uuid)).collect(Collectors.toSet()); }
From source file:com.github.horrorho.inflatabledonkey.cloud.AuthorizeAssetsClient.java
String dsPrsID(Collection<CloudKit.Asset> ckAssets) { return ckAssets.stream().map(CloudKit.Asset::getDsPrsID).findFirst() .orElseThrow(() -> new IllegalArgumentException("missing dsPrsID")); }
From source file:com.antonjohansson.geolocation.provider.ipapi.IpApiProvider.java
@Override public List<LookupResult> lookup(Collection<String> addresses) { List<LookupRequest> requests = addresses.stream().map(LookupRequest::new).collect(toList()); WebClient client = WebClientFactory.endpoint(endpoint).json().build().path("/batch"); if (!isBlank(key)) { client.query("key", key); }/* w ww .j ava2 s. c om*/ Collection<? extends LookupResponse> responses = client.postAndGetCollection(requests, LookupResponse.class); return responses.stream().map(this::toResult).collect(toList()); }
From source file:org.trustedanalytics.examples.hbase.services.ConversionsService.java
public TableDescription constructTableDescription(HTableDescriptor htd) { TableDescription result = null;//from w ww.j av a 2 s. co m if (htd != null) { String name = htd.getNameAsString(); Collection<HColumnDescriptor> families = htd.getFamilies(); List<String> familiesNames = families.stream().map(HColumnDescriptor::getNameAsString) .collect(Collectors.toList()); result = new TableDescription(name, familiesNames); } return result; }
From source file:com.karusmc.commandwork.reference.help.HelpParser.java
public List<String> getCommandUsages(Collection<CommandCallable> commands, Predicate<CommandCallable> predicate) { return commands.stream().filter(predicate).map(subcommand -> ChatColor.GOLD + subcommand.getUsage()) .collect(Collectors.toList()); }
From source file:com.thoughtworks.go.server.service.plugins.builder.DefaultPluginInfoBuilder.java
public Collection allPluginInfos(String type) { if (isBlank(type)) { return builders.values().stream().map(new Function<NewPluginInfoBuilder, Collection>() { @Override//from w ww.j av a2s . c om public Collection apply(NewPluginInfoBuilder builder) { return builder.allPluginInfos(); } }).flatMap(new Function<Collection, Stream<?>>() { @Override public Stream<?> apply(Collection pi) { return pi.stream(); } }).collect(Collectors.toList()); } else if (builders.containsKey(type)) { return builders.get(type).allPluginInfos(); } else { throw new InvalidPluginTypeException(); } }
From source file:edu.elka.peakadvisor.model.CassandraDao.java
public void saveFew(Collection<Latest> collection) { collection.stream().forEach(col -> saveLatest(col)); }
From source file:com.linkedin.pinot.filesystem.LocalPinotFS.java
@Override public String[] listFiles(URI fileUri) throws IOException { File file = new File(fileUri); Collection<File> files = FileUtils.listFiles(file, null, true); return files.stream().map(File::getPath).toArray(String[]::new); }