List of usage examples for java.util Arrays stream
public static DoubleStream stream(double[] array)
From source file:co.runrightfast.vertx.orientdb.config.ServerResource.java
/** * * @param user user name/*w ww. j ava2s .com*/ * @param password user password * @param resources at least 1 is required. The resource names must match the enum names. * @return */ public static OServerUserConfiguration serverUserConfiguration(final String user, final String password, final String... resources) { return serverUserConfiguration(user, password, Arrays.stream(resources).map(ServerResource::valueOf).toArray(ServerResource[]::new)); }
From source file:io.servicecomb.config.DynamicPropertiesImpl.java
DynamicPropertiesImpl(AbstractConfiguration... configurations) { ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration(); Arrays.stream(configurations).forEach(configuration::addConfiguration); ConfigurationManager.install(configuration); }
From source file:com.github.braully.web.DescriptorExposedEntity.java
public DescriptorExposedEntity hiddenForm(String... hiddenProperties) { if (hiddenProperties != null) { Arrays.stream(hiddenProperties).forEach(hp -> this.hiddenFormProperties.add(hp)); }/*w w w .j a v a 2 s. c o m*/ return this; }
From source file:com.samczsun.helios.tasks.AddFilesTask.java
@Override public void run() { try {// ww w. j a v a 2s . c o m Arrays.stream(files).filter(Objects::nonNull).filter(File::exists).map(file -> { try { return file.getCanonicalFile(); } catch (Exception exception) { return file; } }).forEach(file -> { try { if (addToRecentFiles) Helios.addRecentFile(file); handle(file); } catch (IOException e) { ExceptionHandler.handle(e); } }); } finally { Events.callEvent(new TreeUpdateRequest()); } }
From source file:org.trustedanalytics.ingestion.kafka2hdfs.config.KafkaConfiguration.java
private List<String> trackedTopics() { String topics = env.getProperty("TOPICS"); // TODO: could be list in form: topic1:4,topic2:3 // where number stands for number of partitions return Arrays.stream(topics.split(",")).map(String::trim).collect(Collectors.toList()); }
From source file:gobblin.http.ApacheHttpRequest.java
@Override public String toString() { HttpUriRequest request = getRawRequest(); StringBuilder outBuffer = new StringBuilder(); String endl = "\n"; outBuffer.append("ApacheHttpRequest Info").append(endl); outBuffer.append("type: HttpUriRequest").append(endl); outBuffer.append("uri: ").append(request.getURI().toString()).append(endl); outBuffer.append("headers: "); Arrays.stream(request.getAllHeaders()).forEach(header -> outBuffer.append("[").append(header.getName()) .append(":").append(header.getValue()).append("] ")); outBuffer.append(endl);/*from www . jav a 2s . co m*/ if (request instanceof HttpEntityEnclosingRequest) { try { String body = EntityUtils.toString(((HttpEntityEnclosingRequest) request).getEntity()); outBuffer.append("body: ").append(body).append(endl); } catch (IOException e) { outBuffer.append("body: ").append(e.getMessage()).append(endl); } } return outBuffer.toString(); }
From source file:com.github.tmyroadctfig.icloud4j.ICloudException.java
/** * Creates a new exception wrapping the original cause. * * @param response the HTTP response.//from w ww .java2 s. com * @param errorMap the map of error values returned by iCloud. */ public ICloudException(HttpResponse response, Map<String, Object> errorMap) { this.errorMap = ImmutableMap.copyOf(errorMap); this.statusLine = response.getStatusLine(); this.headers = Arrays.stream(response.getAllHeaders()) .collect(Collectors.toMap(Header::getName, Header::getValue)); }
From source file:eu.itesla_project.offline.tools.CreateOfflineWorkflowTool.java
@Override public void run(CommandLine line) throws Exception { String workflowId = line.getOptionValue("workflow"); Set<Country> countries = line.hasOption("base-case-countries") ? Arrays.stream(line.getOptionValue("base-case-countries").split(",")).map(Country::valueOf) .collect(Collectors.toSet()) : getDefaultParameters().getCountries(); DateTime baseCaseDate = line.hasOption("base-case-date") ? DateTime.parse(line.getOptionValue("base-case-date")) : getDefaultParameters().getBaseCaseDate(); Interval histoInterval = line.hasOption("history-interval") ? Interval.parse(line.getOptionValue("history-interval")) : getDefaultParameters().getHistoInterval(); boolean generationSampled = line.hasOption("generation-sampled") || getDefaultParameters().isGenerationSampled(); boolean boundariesSampled = line.hasOption("boundaries-sampled") || getDefaultParameters().isBoundariesSampled(); boolean initTopo = line.hasOption("topo-init") || getDefaultParameters().isInitTopo(); double correlationThreshold = line.hasOption("correlation-threshold") ? Double.parseDouble(line.getOptionValue("correlation-threshold")) : getDefaultParameters().getCorrelationThreshold(); double probabilityThreshold = line.hasOption("probability-threshold") ? Double.parseDouble(line.getOptionValue("probability-threshold")) : getDefaultParameters().getProbabilityThreshold(); boolean loadFlowTransformerVoltageControlOn = line.hasOption("loadflow-transformer-voltage-control-on") || getDefaultParameters().isLoadFlowTransformerVoltageControlOn(); boolean simplifiedWorkflow = line.hasOption("simplified-workflow") || getDefaultParameters().isSimplifiedWorkflow(); boolean mergeOptimized = line.hasOption("merge-optimized") || getDefaultParameters().isMergeOptimized(); Set<Country> attributesCountryFilter = line.hasOption("attributes-country-filter") ? Arrays.stream(line.getOptionValue("attributes-country-filter").split(",")).map(Country::valueOf) .collect(Collectors.toSet()) : getDefaultParameters().getAttributesCountryFilter(); int attributesMinBaseVoltageFilter = line.hasOption("attributes-min-base-voltage-filter") ? Integer.parseInt(line.getOptionValue("attributes-min-base-voltage-filter")) : getDefaultParameters().getAttributesMinBaseVoltageFilter(); OfflineWorkflowCreationParameters parameters = new OfflineWorkflowCreationParameters(countries, baseCaseDate, histoInterval, generationSampled, boundariesSampled, initTopo, correlationThreshold, probabilityThreshold, loadFlowTransformerVoltageControlOn, simplifiedWorkflow, mergeOptimized, attributesCountryFilter, attributesMinBaseVoltageFilter); parameters.print(System.out); try (OfflineApplication app = new RemoteOfflineApplicationImpl()) { String workflowId2 = app.createWorkflow(workflowId, parameters); System.out.println("offline workflow '" + workflowId2 + "' created"); }//from w ww . j a v a2 s . co m }
From source file:com.github.rutledgepaulv.qbuilders.structures.FieldPath.java
public FieldPath append(FieldPath... path) { List<FieldNamespace> newChain = new LinkedList<>(); newChain.addAll(this.chain); newChain.addAll(Arrays.stream(path).flatMap($ -> $.chain.stream()).collect(Collectors.toList())); return new FieldPath(newChain); }
From source file:com.serli.open.data.poitiers.jobs.importer.ImportDefibrillatorsDataJob.java
@Override protected void indexRootElement(FullDefibrillatorJsonFile fullDefibrillatorJsonFile) { Bulk.Builder bulk = new Bulk.Builder().defaultIndex(OPEN_DATA_POITIERS_INDEX) .defaultType(OpenDataRepository.INSTANCE.getElasticType(Defibrillator.class)); DefibrillatorJsonObject[] jsonDefibrillatorFromFiles = fullDefibrillatorJsonFile.defibrillators; Arrays.stream(jsonDefibrillatorFromFiles).forEach(jsonFromFile -> bulk.addAction(getAction(jsonFromFile))); ElasticUtils.createClient().execute(bulk.build()); }