Record Class TimedStorage.ListDelegate<T extends Timed>

java.lang.Object
java.lang.Record
kr.toxicity.model.api.animation.TimedStorage.ListDelegate<T>
Type Parameters:
T - the type of element
Record Components:
list - the backing list
All Implemented Interfaces:
TimedStorage<T>
Enclosing interface:
TimedStorage<T extends Timed>

public static record TimedStorage.ListDelegate<T extends Timed>(@NotNull List<T extends Timed> list) extends Record implements TimedStorage<T>
A TimedStorage implementation that delegates to a List.
Since:
2.0.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface TimedStorage

    TimedStorage.ListDelegate<T>
  • Constructor Summary

    Constructors
    Constructor
    Description
    ListDelegate(@NotNull List<T> list)
    Creates an instance of a ListDelegate record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NonNull T
    get(int index)
    Retrieves the element at the specified index.
    @NonNull T
    Retrieves the last element in the storage.
    final int
    Returns a hash code value for this object.
    @NotNull List<T>
    Returns the value of the list record component.
    int
    Returns the number of elements in the storage.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ListDelegate

      public ListDelegate(@NotNull @NotNull List<T> list)
      Creates an instance of a ListDelegate record class.
      Parameters:
      list - the value for the list record component
  • Method Details

    • get

      public @NonNull T get(int index)
      Description copied from interface: TimedStorage
      Retrieves the element at the specified index.
      Specified by:
      get in interface TimedStorage<T extends Timed>
      Parameters:
      index - the index of the element
      Returns:
      the element
    • size

      public int size()
      Description copied from interface: TimedStorage
      Returns the number of elements in the storage.
      Specified by:
      size in interface TimedStorage<T extends Timed>
      Returns:
      the size
    • getLast

      public @NonNull T getLast()
      Description copied from interface: TimedStorage
      Retrieves the last element in the storage.
      Specified by:
      getLast in interface TimedStorage<T extends Timed>
      Returns:
      the last element
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • list

      @NotNull public @NotNull List<T> list()
      Returns the value of the list record component.
      Returns:
      the value of the list record component