Class NullableTypeStrategy<T>

  • All Implemented Interfaces:
    it.unimi.dsi.fastutil.Hash.Strategy<T>, Comparator<T>

    public final class NullableTypeStrategy<T>
    extends Object
    implements Comparator<T>, it.unimi.dsi.fastutil.Hash.Strategy<T>
    Wrapper of TypeStrategy for nullable types, which stores NullHandling.IS_NULL_BYTE or NullHandling.IS_NOT_NULL_BYTE in the leading byte of any value, as appropriate. If the value is null, only NullHandling.IS_NULL_BYTE will be set, otherwise, the value bytes will be written after the null byte. layout: | null (byte) | value (byte[]) | This is not the most efficient way to track nulls, it is recommended to only use this wrapper if you MUST store null values.
    See Also:
    TypeStrategy
    • Constructor Detail

      • NullableTypeStrategy

        public NullableTypeStrategy​(TypeStrategy<T> delegate)
    • Method Detail

      • estimateSizeBytes

        public int estimateSizeBytes​(@Nullable
                                     T value)
      • readRetainsBufferReference

        public boolean readRetainsBufferReference()
        Whether the read(java.nio.ByteBuffer) methods return an object that may retain a reference to the provided ByteBuffer. If a reference is sometimes retained, this method returns true. It returns false if, and only if, a reference is *never* retained.
      • groupable

        public boolean groupable()
      • hashCode

        public int hashCode​(@Nullable
                            T o)
        Specified by:
        hashCode in interface it.unimi.dsi.fastutil.Hash.Strategy<T>
      • equals

        public boolean equals​(@Nullable
                              T a,
                              @Nullable
                              T b)
        Specified by:
        equals in interface it.unimi.dsi.fastutil.Hash.Strategy<T>