Record Class SampleConfig<T>

java.lang.Object
java.lang.Record
io.reactivex.rxjava4.core.config.SampleConfig<T>
Type Parameters:
T - the element type of the sequence being sampled
Record Components:
emitLast - if true and the upstream completes while there is still an unsampled item available, that item is emitted to downstream before completion if false, an unsampled last item is ignored.
onDropped - called with the current entry when it has been replaced by a new one

public record SampleConfig<T>(boolean emitLast, @NonNull Consumer<? super T> onDropped) extends Record
Configuration record for the timed sample() operator.
Since:
4.0.0
  • Field Details

    • DEFAULT

      public static final SampleConfig<Object> DEFAULT
      Default configuration with no emit last and an empty onDropped consumer.
    • EMIT_LAST

      public static final SampleConfig<Object> EMIT_LAST
      Default configuration with emit last setting and an empty onDropped consumer.
  • Constructor Details

    • SampleConfig

      public SampleConfig(boolean emitLast)
      Creates a config with the given emit last option ad an empty onDropped callback.
      Parameters:
      emitLast - if true and the upstream completes while there is still an unsampled item available, that item is emitted to downstream before completion if false, an unsampled last item is ignored.
    • SampleConfig

      public SampleConfig(@NonNull @NonNull Consumer<? super T> onDropped)
      Creates a config with the given onDropped callback and an no-emit last.
      Parameters:
      onDropped - called with the current entry when it has been replaced by a new one
    • SampleConfig

      public SampleConfig(boolean emitLast, @NonNull @NonNull Consumer<? super T> onDropped)
      Creates a config with the given parameters.
      Parameters:
      emitLast - if true and the upstream completes while there is still an unsampled item available, that item is emitted to downstream before completion if false, an unsampled last item is ignored.
      onDropped - called with the current entry when it has been replaced by a new one
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • emitLast

      public boolean emitLast()
      Returns the value of the emitLast record component.
      Returns:
      the value of the emitLast record component
    • onDropped

      @NonNull public @NonNull Consumer<? super T> onDropped()
      Returns the value of the onDropped record component.
      Returns:
      the value of the onDropped record component