com.ibm.streamsx.topology.logic

Class Value<T>

  • java.lang.Object
    • com.ibm.streamsx.topology.logic.Value<T>
  • Type Parameters:
    T - the value's type
    All Implemented Interfaces:
    Supplier<T>, java.io.Serializable


    public class Value<T>
    extends java.lang.Object
    implements Supplier<T>
    A Supplier for a single constant T value.

    This class can be useful when using the Java application API in the absence of Java8 lambda expressions. e.g.,

    
      // with Java8 Lambda expressions
      TStream<String> s = ...
      s.parallel(() -> 3).filter(...)
      
      // without Lambda expressions
      s.parallel(new Value<Integer>(3)).filter(...)
      
      // using the Value.of with a static import
      s.parallel(of(3)).filter(); 
     
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      Value(T value)
      Create a constant value Supplier.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      T get()
      Return the constant value.
      static <T> Supplier<T> of(T value)
      Return a constant value Supplier.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Value

        public Value(T value)
        Create a constant value Supplier.
        Parameters:
        value - the value
    • Method Detail

      • of

        public static <T> Supplier<T> of(T value)
        Return a constant value Supplier.
        Parameters:
        value - Value of the constant.
        Returns:
        A Supplier that always returns value.
      • get

        public T get()
        Return the constant value.
        Specified by:
        get in interface Supplier<T>
        Returns:
        the value
streamsx.topology 2.1 @ IBMStreams GitHub