Class PartialList<E>


  • public class PartialList<E>
    extends Object
    A List that represents a part of a much bigger list
    Since:
    v3.2
    • Method Detail

      • ofUnknownSize

        @NotNull
        public static <E> @NotNull PartialList<E> ofUnknownSize​(@NotNull
                                                                @NotNull List<E> list)
        Creates a PartialList of unknown total size. The created partial list will not be a complete list.
        Type Parameters:
        E - type of list
        Parameters:
        list - partial list of elements
        Returns:
        new instance of PartialList
      • ofKnownSize

        @NotNull
        public static <E> @NotNull PartialList<E> ofKnownSize​(@NotNull
                                                              @NotNull List<E> list,
                                                              int totalSize)
        Creates a PartialList of known total size. The created partial list might be a complete list.
        Type Parameters:
        E - type of list
        Parameters:
        list - partial list of elements
        totalSize - total number of elements in the collection
        Returns:
        new instance of PartialList
      • ofKnownSize

        @NotNull
        public static <E> @NotNull PartialList<E> ofKnownSize​(@NotNull
                                                              @NotNull List<E> list,
                                                              long totalSize)
        Creates a PartialList of known total size. The created partial list might be a complete list.
        Type Parameters:
        E - type of list
        Parameters:
        list - partial list of elements
        totalSize - total number of elements in the collection
        Returns:
        new instance of PartialList
      • isTotalSizeKnown

        public boolean isTotalSizeKnown()
        Returns:
        true if the total size of the bigger collection is known
      • getTotalSize

        public long getTotalSize()
        Returns:
        total size of the big collection, -1 if it's unknown
      • getList

        @NotNull
        public @NotNull List<E> getList()
        Returns:
        partial list of elements from the bigger collection
      • isCompleteList

        public boolean isCompleteList()
        Returns:
        true if the list has all the elements of the bigger collection