Class PaginatedList<E>

java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
com.google.common.collect.ForwardingList<E>
org.graylog2.database.PaginatedList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>

public class PaginatedList<E> extends com.google.common.collect.ForwardingList<E>
  • Constructor Details

    • PaginatedList

      public PaginatedList(@Nonnull List<E> delegate, int total, int page, int perPage)
      Creates a PaginatedList
      Parameters:
      delegate - the actual entries
      total - the count of all entries (ignoring pagination)
      page - the page this PaginatedList represents
      perPage - the size limit for each page
    • PaginatedList

      public PaginatedList(@Nonnull List<E> delegate, int total, int page, int perPage, Long grandTotal)
      Creates a PaginatedList
      Parameters:
      delegate - the actual entries
      total - the count of all entries (ignoring pagination)
      page - the page this PaginatedList represents
      perPage - the size limit for each page
      grandTotal - the count of all entries (ignoring query filters and pagination)
  • Method Details

    • delegate

      public List<E> delegate()
      Specified by:
      delegate in class com.google.common.collect.ForwardingList<E>
    • pagination

      public PaginatedList.PaginationInfo pagination()
    • grandTotal

      public Optional<Long> grandTotal()
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Collection<E>
      Specified by:
      equals in interface List<E>
      Overrides:
      equals in class com.google.common.collect.ForwardingList<E>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<E>
      Specified by:
      hashCode in interface List<E>
      Overrides:
      hashCode in class com.google.common.collect.ForwardingList<E>
    • toString

      public String toString()
      Overrides:
      toString in class com.google.common.collect.ForwardingObject
    • emptyList

      public static <T> PaginatedList<T> emptyList(int page, int perPage)
    • singleton

      public static <T> PaginatedList<T> singleton(T entry, int page, int perPage)