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:io.sqp.schemamatcher.fieldmatchers.FieldMatcher.java

public static boolean allMatch(FieldMatcher[] fieldMatchers, JsonNode other) {
    return Arrays.stream(fieldMatchers).allMatch(m -> m.isCompatibleTo(other));
}

From source file:com.github.xdcrafts.flower.spring.impl.MiddlewareDefinition.java

private static List<String> split(String string) {
    return Arrays.stream(string.split(SPLITTER_REGEX)).map(String::trim).collect(Collectors.toList());
}

From source file:com.thoughtworks.go.util.StringUtil.java

public static String joinSentences(String... strings) {
    return Arrays.stream(strings).map(String::trim).map(s -> s.endsWith(".") ? s : s + ".")
            .collect(Collectors.joining(" "));
}

From source file:com.thinkbiganalytics.nifi.provenance.model.util.ProvenanceEventDtoUtil.java

public static boolean contains(String[] allowedEvents, String event) {
    return Arrays.stream(allowedEvents).anyMatch(event::equals);
}

From source file:com.ejisto.util.ContainerUtils.java

public static String extractAgentJar(String classPath) {
    String systemProperty = System.getProperty("ejisto.agent.jar.path");
    if (StringUtils.isNotBlank(systemProperty)) {
        return systemProperty;
    }//from   w w  w  .  java2 s  . c o m

    final Optional<String> agentPath = Arrays.stream(classPath.split(Pattern.quote(File.pathSeparator)))
            .filter(e -> AGENT_JAR.matcher(e).matches()).findFirst();
    if (agentPath.isPresent()) {
        return Paths.get(System.getProperty("user.dir"), agentPath.get()).toString();
    }
    throw new IllegalStateException("unable to find agent jar");
}

From source file:com.simiacryptus.text.LanguageModel.java

/**
 * Match language model./*  w ww  .  j  a  v  a2  s .  co  m*/
 *
 * @param text the text
 * @return the language model
 */
public static LanguageModel match(String text) {
    return Arrays.stream(LanguageModel.values())
            .min(Comparator.comparing(model -> model.getTrie().getCodec().encodePPM(text, 2).bitLength)).get();
}

From source file:com.synopsys.integration.util.EnumUtils.java

public static <T extends Enum<T>> List<T> parseCommaDelimitted(String commaDelimittedEnumString,
        Class<T> enumClass) {
    return Arrays.stream(commaDelimittedEnumString.split(",")).map(String::trim).filter(StringUtils::isNotBlank)
            .map(token -> Enum.valueOf(enumClass, token)).collect(Collectors.toList());
}

From source file:io.syndesis.credential.CredentialFlowStateHelper.java

static Set<CredentialFlowState> restoreFrom(final Restorer restore,
        final HttpServletRequest request) {
    final Cookie[] servletCookies = request.getCookies();

    if (ArrayUtils.isEmpty(servletCookies)) {
        return Collections.emptySet();
    }/* w ww.  j a v  a2s  .  co  m*/

    final List<javax.ws.rs.core.Cookie> credentialCookies = Arrays.stream(servletCookies)
            .filter(c -> c.getName().startsWith(CredentialFlowState.CREDENTIAL_PREFIX))
            .map(CredentialFlowStateHelper::toJaxRsCookie).collect(Collectors.toList());

    try {
        return restore.apply(credentialCookies, CredentialFlowState.class);
    } catch (final IllegalArgumentException e) {
        return Collections.emptySet();
    }
}

From source file:jmb.jcortex.mapfunctions.SoftMaxActivationFunction.java

@Override
public double[] apply(double[] input) {
    double[] exp = Arrays.stream(input).map(FastMath::exp).toArray();
    double sum = Arrays.stream(exp).sum();
    return Arrays.stream(exp).map(value -> value / sum).toArray();
}

From source file:com.csc.fi.ioapi.utils.LDHelper.java

public static boolean isPrefixResolvable(String item) {
    return !Arrays.stream(UNRESOLVABLE).anyMatch(item::equals);
}