Class CacheCollectors


  • public class CacheCollectors
    extends java.lang.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 Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​R>
      java.util.stream.Collector<T,​?,​R>
      collector​(java.util.function.Supplier<java.util.stream.Collector<T,​?,​R>> supplier)
      Similar to serializableCollector(SerializableSupplier) except that the supplier provided must be marshable through ISPN marshalling techniques.
      static <T,​R>
      java.util.stream.Collector<T,​?,​R>
      serializableCollector​(SerializableSupplier<java.util.stream.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.
      • Methods inherited from class java.lang.Object

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

      • serializableCollector

        public static <T,​R> java.util.stream.Collector<T,​?,​R> serializableCollector​(SerializableSupplier<java.util.stream.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:
        SerializableSupplier
      • collector

        public static <T,​R> java.util.stream.Collector<T,​?,​R> collector​(java.util.function.Supplier<java.util.stream.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:
        Externalizer, AdvancedExternalizer