Example usage for java.util Arrays stream

List of usage examples for java.util Arrays stream

Introduction

In this page you can find the example usage for java.util Arrays stream.

Prototype

public static DoubleStream stream(double[] array) 

Source Link

Document

Returns a sequential DoubleStream with the specified array as its source.

Usage

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

public boolean containsAllFiles(final File sourceDirectory, final String... filenamePatterns) {
    if (!sourceDirectory.isDirectory()) {
        return false;
    }//from   w w w.  java2 s.c om

    return Arrays.stream(filenamePatterns).allMatch(pattern -> findFile(sourceDirectory, pattern) != null);
}

From source file:alfio.model.transaction.PaymentProxy.java

public static Optional<PaymentProxy> safeValueOf(String name) {
    return Arrays.stream(values()).filter(p -> StringUtils.equals(p.name(), name)).findFirst();
}

From source file:org.jimsey.projects.turbine.condenser.service.TurbineService.java

public List<Stocks> getStocks(String market) {
    return Arrays.stream(Stocks.values()).filter(stock -> stock.getMarket().equals(market))
            .collect(Collectors.toList());
}

From source file:io.mapzone.controller.catalog.http.CatalogRequest.java

void parseParameters() {
    for (Enumeration<String> it = httpRequest.getParameterNames(); it.hasMoreElements();) {
        String name = normalize(it.nextElement());
        String[] values = httpRequest.getParameterValues(name);
        Arrays.stream(values).forEach(value -> params.put(name, value));
    }/*from   ww w  .  ja  v  a  2  s.  c om*/
}

From source file:com.blackducksoftware.integration.hub.detect.detector.yarn.YarnLockParser.java

private List<String> getFuzzyIdsFromLine(final String s) {
    final String[] lines = s.split(",");
    return Arrays.stream(lines).map(line -> line.trim().replaceAll("\"", "").replaceAll(":", ""))
            .collect(Collectors.toList());
}

From source file:ninja.eivind.hotsreplayuploader.utils.StormHandler.java

private static long maxLastModified(File dir) {
    File[] files = getReplayDirectory(dir).listFiles();
    if (files == null || files.length < 1)
        return Long.MIN_VALUE;
    return Arrays.stream(files).mapToLong(File::lastModified).max().orElse(Long.MIN_VALUE);
}

From source file:hudson.os.WindowsUtil.java

/**
 * Executes a command and arguments using {@code cmd.exe /C ...}.
 */// w w  w  .  j  a v a  2  s. c o m
public static @Nonnull Process execCmd(String... argv) throws IOException {
    String command = Arrays.stream(argv).map(WindowsUtil::quoteArgumentForCmd).collect(Collectors.joining(" "));
    return Runtime.getRuntime().exec(new String[] { "cmd.exe", "/C", command });
}

From source file:async.nio2.Main.java

private static DescriptiveStatistics combine(DescriptiveStatistics stats1, DescriptiveStatistics stats2) {
    Arrays.stream(stats2.getValues()).forEach(d -> stats1.addValue(d));
    stats2.clear();/* w  ww  .jav a 2s. c  o  m*/
    return stats1;
}

From source file:cop.raml.mocks.MockUtils.java

public static ExecutableElementMock createExecutable(Method method) {
    if (method == null)
        return null;

    boolean isStatic = Modifier.isStatic(method.getModifiers());
    String params = Arrays.stream(method.getParameterTypes()).map(Class::getSimpleName)
            .collect(Collectors.joining(","));
    String name = String.format("(%s)%s", params, method.getReturnType().getSimpleName());

    return new ExecutableElementMock(method.getName() + "()", createMethodElement(name).asType())
            .setStatic(isStatic).setSimpleName(method.getName());
}

From source file:org.trustedanalytics.examples.hbase.services.HBaseService.java

/**
 * Get list of tables in given namespace;
 *///from ww  w  . j a v  a  2s  .  c o  m
public List<TableDescription> listTables() throws LoginException {
    List<TableDescription> result = null;

    try (Connection connection = hBaseConnectionFactory.connect(); Admin admin = connection.getAdmin()) {
        HTableDescriptor[] tables = admin.listTables();

        Stream<HTableDescriptor> tableDescriptorsStream = Arrays.stream(tables);

        result = tableDescriptorsStream.map(conversionsService::constructTableDescription)
                .collect(Collectors.toList());
    } catch (IOException e) {
        LOG.error("Error while talking to HBase.", e);
    }

    return result;
}