Interface SilverpeasList<T>

    • Method Detail

      • collector

        static <C,​R extends SilverpeasList<C>> Collector<C,​R,​R> collector​(List<?> source)
        Returns a Collector that accumulates the input items into a new SilverpeasList. There are no guarantees on the type, mutability, serializability, or thread-safety of the returned SilverpeasList.

        If the source is already a SilverpeasList, then the returned list will be of the same concrete type than the source list.

        Type Parameters:
        C - the type of the input items in the destination list.
        R - the concrete type of the SilverpeasList.
        Parameters:
        source - the source list from which a SilverpeasList is built.
        Returns:
        a Collector which collects all the input elements into a SilverpeasList, in encounter order.
      • wrap

        static <T> SilverpeasList<T> wrap​(List<T> listToWrap)
        Gets a wrapper of any kind of implementation of List in order to get a SilverpeasList behaviour.

        If the given list is already a SilverpeasList one, no wrap is done and the given instance is returned immediately.

        Type Parameters:
        T - the type of the elements into the list.
        Parameters:
        listToWrap - the list to wrap.
        Returns:
        the SilverpeasList instance.
      • newEmptyListWithSameProperties

        <U> SilverpeasList<U> newEmptyListWithSameProperties()
        Builds a new empty SilverpeasList with the same properties than this list.

        This method is mainly dedicated to be used for making a collector for the Java Stream API.

        Type Parameters:
        U - the concrete type of the items of the returned list.
        Returns:
        an empty SilverpeasList with the same properties than this list.
      • originalListSize

        long originalListSize()
        Gets the number of items the original list contains.

        If the list is a slice of a larger one, the originalListSize() returns a higher result than the one of List.size(), otherwise originalListSize() and List.size() returns the same result.

        Returns:
        the original size of the list as long.
      • isSlice

        default boolean isSlice()
        Indicates if the list is a slice of a larger one.
        Returns:
        true if it represents a slice, false otherwise.