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

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

Best Java code snippets using java.util.stream.Stream.empty (Showing top 20 results out of 6,291)

Refine searchRefine arrow

  • Stream.of
origin: neo4j/neo4j

  public static <T> Stream<T> ofNullable( T obj )
  {
    if ( obj == null )
    {
      return Stream.empty();
    }
    else
    {
      return Stream.of( obj );
    }
  }
}
origin: reactor/reactor-core

  @Override
  public Stream<? extends Scannable> inners() {
    FilterWhenInner c = asyncFilter;
    return c == null ? Stream.empty() : Stream.of(c);
  }
}
origin: reactor/reactor-core

  @Override
  public Stream<? extends Scannable> inners() {
    FilterWhenInner c = current;
    return c == null ? Stream.empty() : Stream.of(c);
  }
}
origin: reactor/reactor-core

@Override
public Stream<? extends Scannable> inners() {
  UnicastProcessor<T> w = window;
  return w == null ? Stream.empty() : Stream.of(w);
}
origin: speedment/speedment

public static <T> Stream<T> streamOfNullable(T element) {
  // Needless to say, element is nullable...
  if (element == null) {
    return Stream.empty();
  } else {
    return Stream.of(element);
  }
}
origin: reactor/reactor-core

@Override
public Stream<? extends Scannable> inners() {
  return  window == null ? Stream.empty() : Stream.of(window);
}
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: neo4j/neo4j

public Stream<CompilationMessage> validateReturnType( ExecutableElement method )
{
  TypeMirror returnType = method.getReturnType();
  if ( !allowedTypesValidator.test( returnType ) )
  {
    return Stream.of( new ReturnTypeError( method,
        "Unsupported return type <%s> of function defined in <%s#%s>.", returnType,
        method.getEnclosingElement(), method.getSimpleName() ) );
  }
  return Stream.empty();
}
origin: neo4j/neo4j

private Stream<CompilationMessage> validateParameters( ExecutableElement resultMethod,
    Class<? extends Annotation> annotation )
{
  if ( !isValidAggregationSignature( resultMethod ) )
  {
    return Stream.of( new AggregationError( resultMethod,
        "@%s usage error: method should be public, non-static and without parameters.",
        annotation.getSimpleName() ) );
  }
  return Stream.empty();
}
origin: lettuce-io/lettuce-core

  /**
   * Returns a {@link Stream} wrapper for the value. The resulting stream contains either the value if a this value
   * {@link #hasValue() has a value} or it is empty if the value is empty.
   *
   * @return {@link Stream} wrapper for the value.
   */
  public Stream<V> stream() {

    if (hasValue()) {
      return Stream.of(value);
    }
    return Stream.empty();
  }
}
origin: speedment/speedment

public static Stream<Field> traverseFields(Class<?> clazz) {
  final Class<?> parent = clazz.getSuperclass();
  final Stream<Field> inherited;
  if (parent != null) {
    inherited = traverseFields(parent);
  } else {
    inherited = Stream.empty();
  }
  return Stream.concat(inherited, Stream.of(clazz.getDeclaredFields()));
}
origin: neo4j/neo4j

private static Stream<CompilationMessage> validateNonContextField( VariableElement field )
{
  Set<Modifier> modifiers = field.getModifiers();
  if ( !modifiers.contains( Modifier.STATIC ) )
  {
    return Stream.of( new FieldError( field, "Field %s#%s should be static",
        field.getEnclosingElement().getSimpleName(), field.getSimpleName() ) );
  }
  return Stream.empty();
}
origin: SonarSource/sonarqube

private String guessResponseType(String path, String action) {
 return guessResponseOuterClassName(path).flatMap(
  potentialClassName -> guessResponseInnerClassName(action).flatMap(potentialInnerClassName -> {
   try {
    String guess = "org.sonarqube.ws." + potentialClassName + "$" + potentialInnerClassName;
    Helper.class.forName(guess);
    return Stream.of(guess.replaceFirst("\\$", "."));
   } catch (ClassNotFoundException e) {
   }
   return Stream.empty();
  })).findFirst().orElseGet(() -> {
   return "String";
  });
}
origin: biezhi/30-seconds-of-java8

public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
  return Stream.concat(
      Arrays.stream(cls.getInterfaces()).flatMap(intf ->
          Stream.concat(Stream.of(intf), getAllInterfaces(intf).stream())),
      cls.getSuperclass() == null ? Stream.empty() : getAllInterfaces(cls.getSuperclass()).stream()
  ).distinct().collect(Collectors.toList());
}
origin: thinkaurelius/titan

@Override
public Stream<M> receiveMessages(MessageScope messageScope) {
  if (messageScope instanceof MessageScope.Global) {
    return super.receiveMessages(messageScope);
  } else {
    final MessageScope.Local<M> localMessageScope = (MessageScope.Local) messageScope;
    M aggregateMsg = vertexMemory.getAggregateMessage(vertexId,localMessageScope);
    if (aggregateMsg==null) return Stream.empty();
    else return Stream.of(aggregateMsg);
  }
}
origin: neo4j/neo4j

public Stream<CompilationMessage> validateName( ExecutableElement method )
{
  Optional<String> customName = customNameExtractor.apply( method.getAnnotation( annotationType ) );
  if ( customName.isPresent() )
  {
    if ( isInRootNamespace( customName.get() ) )
    {
      return Stream.of( rootNamespaceError( method, customName.get() ) );
    }
    return Stream.empty();
  }
  PackageElement namespace = elements.getPackageOf( method );
  if ( namespace == null )
  {
    return Stream.of( rootNamespaceError( method ) );
  }
  return Stream.empty();
}
origin: SonarSource/sonarqube

private Stream<String> createOracleAutoIncrementStatements() {
 if (!Oracle.ID.equals(dialect.getId())) {
  return Stream.empty();
 }
 return pkColumnDefs.stream()
  .filter(this::isAutoIncrement)
  .flatMap(columnDef -> of(createSequenceFor(tableName), createOracleTriggerForTable(tableName)));
}
origin: neo4j/neo4j

private Stream<CompilationMessage> validateModifiers( VariableElement field )
{
  if ( !hasValidModifiers( field ) )
  {
    return Stream.of( new ContextFieldError( field,
        "@%s usage error: field %s should be public, non-static and non-final", Context.class.getName(),
        fieldFullName( field ) ) );
  }
  return Stream.empty();
}
origin: neo4j/neo4j

private Stream<CompilationMessage> validateAggregationUpdateMethod( ExecutableElement aggregationFunction, Element returnType,
    List<ExecutableElement> updateMethods )
{
  if ( updateMethods.size() != 1 )
  {
    return Stream.of( missingAnnotation( aggregationFunction, returnType, updateMethods, UserAggregationUpdate.class ) );
  }
  Stream<CompilationMessage> errors = Stream.empty();
  ExecutableElement updateMethod = updateMethods.iterator().next();
  if ( !isValidUpdateSignature( updateMethod ) )
  {
    errors = Stream.of( new AggregationError( updateMethod,
        "@%s usage error: method should be public, non-static and define 'void' as return type.",
        UserAggregationUpdate.class.getSimpleName() ) );
  }
  return Stream.concat( errors, functionVisitor.validateParameters( updateMethod.getParameters() ) );
}
origin: micronaut-projects/micronaut-core

@Override
public Set<? extends RxWebSocketSession> getOpenSessions() {
  return webSocketSessionRepository.getChannelGroup().stream().flatMap((Function<Channel, Stream<RxWebSocketSession>>) ch -> {
    NettyRxWebSocketSession s = ch.attr(NettyRxWebSocketSession.WEB_SOCKET_SESSION_KEY).get();
    if (s != null && s.isOpen()) {
      return Stream.of(s);
    }
    return Stream.empty();
  }).collect(Collectors.toSet());
}
java.util.streamStreamempty

Popular methods of Stream

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

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • BoxLayout (javax.swing)
  • 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