Class GuiVirtualListSnapshot<K,V>

java.lang.Object
com.render.api.gui.GuiVirtualListSnapshot<K,V>
Type Parameters:
K - stable row key
V - application value

public final class GuiVirtualListSnapshot<K,V> extends Object
Immutable, ordered keyed data for VirtualListComponent. Copying, filtering and sorting happen when a new snapshot is supplied, rather than during a clean rendered frame. Keys and values must themselves be immutable, and keys must keep stable equality and hash codes. Every row has an explicit positive height in design pixels.
  • Constructor Details

    • GuiVirtualListSnapshot

      public GuiVirtualListSnapshot(List<GuiVirtualListSnapshot.Entry<K,V>> entries)
      Copies and validates an ordered row list, rejecting duplicate keys before any component changes.
  • Method Details

    • empty

      public static <K,V> GuiVirtualListSnapshot<K,V> empty()
      Creates an empty snapshot.
    • of

      public static <K,V> GuiVirtualListSnapshot<K,V> of(List<V> values, Function<? super V, ? extends K> keys, ToDoubleFunction<? super V> heights)
      Copies application values with explicitly selected keys and row heights.
    • entries

      public List<GuiVirtualListSnapshot.Entry<K,V>> entries()
      Returns:
      immutable rows in display order
    • size

      public int size()
      Returns:
      number of data rows, including rows outside the viewport
    • indexOf

      public OptionalInt indexOf(K key)
      Looks up a stable key without scanning the data.
    • filter

      public GuiVirtualListSnapshot<K,V> filter(Predicate<? super V> predicate)
      Filters rows while preserving their keys, heights and relative order.
    • sorted

      public GuiVirtualListSnapshot<K,V> sorted(Comparator<? super V> comparator)
      Sorts a copied row list, retaining keyed selection and row identity when installed in a component.