Class CacheCollectors

java.lang.Object
org.infinispan.stream.CacheCollectors

public class CacheCollectors extends Object
Helper class designed to be used to create a serializable Collector for use with CacheStream.collect(Collector) from a supplier of a collector. The problem is that the standard Collectors class doesn't provide Serializable Collectors and no way to extend their functionality, so this class is used instead.
  • Method Details

    • serializableCollector

      public static <T, R> Collector<T,?,R> serializableCollector(SerializableSupplier<Collector<T,?,R>> supplier)
      Creates a collector that is serializable and will upon usage create a collector using the serializable supplier provided by the user.
      Type Parameters:
      T - The input type of the collector
      R - The resulting type of the collector
      Parameters:
      supplier - The supplier to crate the collector that is specifically serializable
      Returns:
      the collector which is serializable
      See Also:
    • collector

      public static <T, R> Collector<T,?,R> collector(Supplier<Collector<T,?,R>> supplier)
      Similar to serializableCollector(SerializableSupplier) except that the supplier provided must be marshable through ISPN marshalling techniques. Note this is not detected until runtime.
      Type Parameters:
      T - The input type of the collector
      R - The resulting type of the collector
      Parameters:
      supplier - The marshallable supplier of collectors
      Returns:
      the collector which is serializable
      See Also: