com.ibm.streamsx.topology.function (Java Application API for IBM Streams)
Date: 2020-08-07

# Package com.ibm.streamsx.topology.function

Classes that provide the mechanisms to implement functional transformations on streams.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  BiFunction<T1,T2,R> | A function that is passed two arguments and returns a value.
  Consumer<T> | A function that takes an argument and returns nothing.
  Function<T,R> | A function that is passed an argument and returns a value.
  FunctionContainer | Container for a function executing in a IBM Streams application.
  FunctionContext | Context for a function executing in a IBM Streams application.
  Initializable | Optional interface that a function can implement to perform initialization.
  ObjIntConsumer<T> |
  Predicate<T> | A function that tests a tuple.
  Supplier<T> | A function that supplies a value.
  ToIntFunction<T> | A function that applies a computation to a tuple and returns an `int` result.
  UnaryOperator<T> | Specialization of `Function` where the return type is the same as the argument type.

## Package com.ibm.streamsx.topology.function Description

Classes that provide the mechanisms to implement functional transformations on streams.
Note that implementations of the functional classes must implement `java.io.Serializable`, and are always serialized and deserialized before use. Thus the actual instance passed into a method when declaring the `Topology` is not used at runtime. The instance must capture any local state in its serialized state to ensure the values are available at runtime.
When an anonymous class is used as an instance then typically it must be created in a static context, otherwise it will capture a reference to the instance it is created from. This typically is not what is required.

If the implementation of the functional class implements `Initializable` then `Initializable.initialize(FunctionContext)` will be called when the processing element containing the function starts or restarts.

If the implementation of the functional class implements `java.lang.AutoCloseable` then the `close()` method will be called when the application terminates.

See Also:
  `TStream`