Tabnine Logo
Stream.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
java.util.stream.Stream

Best Java code snippets using java.util.stream.Stream.of (Showing top 20 results out of 23,589)

Refine searchRefine arrow

  • Stream.filter
  • Collectors.toSet
  • Stream.collect
  • Stream.findFirst
  • Optional.orElse
  • Collectors.toList
origin: neo4j/neo4j

private String addressConfigurationDescription()
{
  return Stream.of( httpAddress, httpsAddress )
      .filter( Objects::nonNull )
      .map( Object::toString )
      .collect( joining( ", " ) );
}
origin: lets-blade/blade

private static void cacheMethod(Map<Class<? extends Annotation>, Method> cache, Method[] methods, Class<? extends Annotation> filter) {
  List<Method> methodList = Stream.of(methods)
      .filter(method -> method.isAnnotationPresent(filter))
      .collect(Collectors.toList());
  if (methodList.size() == 1) {
    cache.put(filter, methodList.get(0));
  } else if (methodList.size() > 1) {
    throw new RuntimeException("Duplicate annotation @" + filter.getSimpleName() + " in class: " + methodList.get(0).getDeclaringClass().getName());
  }
}
origin: org.apache.ant/ant

/**
 * Returns the topmost interface that extends Remote for a given
 * class - if one exists.
 * @param testClass the class to be tested
 * @return the topmost interface that extends Remote, or null if there
 *         is none.
 */
public Class<?> getRemoteInterface(Class<?> testClass) {
  return Stream.of(testClass.getInterfaces())
    .filter(Remote.class::isAssignableFrom).findFirst().orElse(null);
}
origin: SonarSource/sonarqube

 private static Set<String> getPossibleOperators() {
  return Stream.of(Condition.Operator.values())
   .map(Condition.Operator::getDbValue)
   .collect(Collectors.toSet());
 }
}
origin: google/guava

public void testToOptionalNull() {
 Stream<Object> stream = Stream.of((Object) null);
 try {
  stream.collect(MoreCollectors.toOptional());
  fail("Expected NullPointerException");
 } catch (NullPointerException expected) {
 }
}
origin: baomidou/mybatis-plus

@Override
protected List<String> list(URL url, String path) throws IOException {
  Resource[] resources = resourceResolver.getResources("classpath*:" + path + "/**/*.class");
  return Stream.of(resources)
    .map(resource -> preserveSubpackageName(resource, path))
    .collect(Collectors.toList());
}
origin: micronaut-projects/micronaut-core

@SuppressWarnings("unchecked")
@Override
public Optional<? extends ExecutableMethod<?, ?>> findFirst() {
  return Stream.of(functions, suppliers, consumers, biFunctions)
    .map(all -> {
      Collection<ExecutableMethod<?, ?>> values = all.values();
      return values.stream().findFirst();
    }).filter(Optional::isPresent)
    .map(Optional::get)
    .findFirst();
}
origin: speedment/speedment

public static <T> Stream<T> streamOfOptional(@SuppressWarnings("OptionalUsedAsFieldOrParameterType") Optional<T> element) {
  return Stream.of(element.orElse(null)).filter(Objects::nonNull);
}
origin: sqshq/piggymetrics

  public static Frequency withDays(int days) {
    return Stream.of(Frequency.values())
        .filter(f -> f.getDays() == days)
        .findFirst()
        .orElseThrow(IllegalArgumentException::new);
  }
}
origin: prestodb/presto

  @Override
  public Result apply(SemiJoinNode semiJoinNode, Captures captures, Context context)
  {
    Set<Symbol> requiredFilteringSourceInputs = Streams.concat(
        Stream.of(semiJoinNode.getFilteringSourceJoinSymbol()),
        semiJoinNode.getFilteringSourceHashSymbol().map(Stream::of).orElse(Stream.empty()))
        .collect(toImmutableSet());

    return restrictOutputs(context.getIdAllocator(), semiJoinNode.getFilteringSource(), requiredFilteringSourceInputs)
        .map(newFilteringSource ->
            semiJoinNode.replaceChildren(ImmutableList.of(semiJoinNode.getSource(), newFilteringSource)))
        .map(Result::ofPlanNode)
        .orElse(Result.empty());
  }
}
origin: neo4j/neo4j

private StoreType[] relevantRecordStores()
{
  return Stream.of( StoreType.values() )
      .filter( type -> type.isRecordStore() && type != StoreType.META_DATA ).toArray( StoreType[]::new );
}
origin: baomidou/mybatis-plus

public Resource[] resolveMapperLocations() {
  return Stream.of(Optional.ofNullable(this.mapperLocations).orElse(new String[0]))
    .flatMap(location -> Stream.of(getResources(location)))
    .toArray(Resource[]::new);
}
origin: lets-blade/blade

private static void cacheMethod(Map<Class<? extends Annotation>, Method> cache, Method[] methods, Class<? extends Annotation> filter) {
  List<Method> methodList = Stream.of(methods)
      .filter(method -> method.isAnnotationPresent(filter))
      .collect(Collectors.toList());
  if (methodList.size() == 1) {
    cache.put(filter, methodList.get(0));
  } else if (methodList.size() > 1) {
    throw new RuntimeException("Duplicate annotation @" + filter.getSimpleName() + " in class: " + methodList.get(0).getDeclaringClass().getName());
  }
}
origin: SonarSource/sonarqube

 private static File locateHomeDir(Configuration configuration) {
  return Stream.of(
   configuration.get("sonar.userHome").orElse(null),
   System.getenv("SONAR_USER_HOME"),
   System.getProperty("user.home") + File.separator + ".sonar")
   .filter(Objects::nonNull)
   .findFirst()
   .map(File::new)
   .get();
 }
}
origin: SonarSource/sonarqube

 static Set<Metric> extractMetrics(List<IssueMetricFormula> formulas) {
  return formulas.stream()
   .flatMap(f -> Stream.concat(Stream.of(f.getMetric()), f.getDependentMetrics().stream()))
   .collect(Collectors.toSet());
 }
}
origin: google/guava

public void testOnlyElementMultiple() {
 try {
  Stream.of(1, 2).collect(MoreCollectors.onlyElement());
  fail("Expected IllegalArgumentException");
 } catch (IllegalArgumentException expected) {
  assertThat(expected.getMessage()).contains("1, 2");
 }
}
origin: prestodb/presto

@Override
public List<SchemaTableName> listTables(ConnectorSession session, String schemaNameOrNull)
{
  if (schemaNameOrNull == null) {
    return Stream.of(AtopTable.values())
        .map(table -> new SchemaTableName(environment, table.getName()))
        .collect(Collectors.toList());
  }
  if (!listSchemaNames(session).contains(schemaNameOrNull)) {
    return ImmutableList.of();
  }
  return Stream.of(AtopTable.values())
      .map(table -> new SchemaTableName(schemaNameOrNull, table.getName()))
      .collect(Collectors.toList());
}
origin: SonarSource/sonarqube

private static String buildDirectoryProjectRelativePath(Map<String, String> pathByModuleKey, ComponentDto c, ComponentDto parentModule) {
 String moduleProjectRelativePath = buildModuleProjectRelativePath(pathByModuleKey, parentModule);
 return Stream.of(moduleProjectRelativePath, c.path())
  .map(StringUtils::trimToNull)
  .filter(s -> s != null && !"/".equals(s))
  .collect(Collectors.joining("/"));
}
origin: neo4j/neo4j

  private Stream<CompilationMessage> validateConstructor( Element extensionClass )
  {
    Optional<ExecutableElement> publicNoArgConstructor =
        constructorsIn( extensionClass.getEnclosedElements() ).stream()
            .filter( c -> c.getModifiers().contains( Modifier.PUBLIC ) )
            .filter( c -> c.getParameters().isEmpty() ).findFirst();

    if ( !publicNoArgConstructor.isPresent() )
    {
      return Stream.of( new ExtensionMissingPublicNoArgConstructor( extensionClass,
          "Extension class %s should contain a public no-arg constructor, none found.", extensionClass ) );
    }
    return Stream.empty();
  }
}
origin: SonarSource/sonarqube

private void validatePullRequestParamsWhenPluginAbsent(List<String> validationMessages) {
 Stream.of(PULL_REQUEST_KEY, PULL_REQUEST_BRANCH, PULL_REQUEST_BASE)
  .filter(param -> nonNull(settings.get(param).orElse(null)))
  .forEach(param -> validationMessages.add(format("To use the property \"%s\", the branch plugin is required but not installed. "
   + "See the documentation of branch support: %s.", param, BRANCHES_DOC_LINK)));
}
java.util.streamStreamof

Popular methods of Stream

  • collect
  • map
  • filter
  • forEach
  • findFirst
  • anyMatch
  • flatMap
  • sorted
  • toArray
  • findAny
  • count
  • allMatch
  • count,
  • allMatch,
  • concat,
  • reduce,
  • mapToInt,
  • distinct,
  • empty,
  • noneMatch,
  • iterator

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now