Interface ISequence<ITEM_TYPE extends IItem>

    • Method Detail

      • empty

        @NonNull
        static <ITEM_TYPE extends IItemISequence<ITEM_TYPE> empty()
        Get an empty sequence.
        Type Parameters:
        ITEM_TYPE - the item type
        Returns:
        the empty sequence
      • of

        @NonNull
        static <ITEM_TYPE extends IItemISequence<ITEM_TYPE> of​(@Nullable
                                                                 ITEM_TYPE item)
        Construct a new sequence containing the provided item.

        If the item is null and empty sequence will be created.

        Type Parameters:
        ITEM_TYPE - the type of items contained in the sequence.
        Parameters:
        item - the item to add to the sequence
        Returns:
        the new sequence
      • of

        @NonNull
        static <ITEM_TYPE extends IItemISequence<ITEM_TYPE> of​(@NonNull
                                                                 List<ITEM_TYPE> items)
        Construct a new sequence containing the provided items.
        Type Parameters:
        ITEM_TYPE - the type of items contained in the sequence.
        Parameters:
        items - the items to add to the sequence
        Returns:
        the new sequence
      • of

        @NonNull
        static <ITEM_TYPE extends IItemISequence<ITEM_TYPE> of​(Stream<ITEM_TYPE> items)
        Construct a new sequence containing the provided items.
        Type Parameters:
        ITEM_TYPE - the type of items contained in the sequence.
        Parameters:
        items - the items to add to the sequence
        Returns:
        the new sequence
      • asList

        @NonNull
        List<ITEM_TYPEasList()
        Get the items in this sequence as a List.
        Returns:
        a list containing all the items of the sequence
      • asStream

        @NonNull
        Stream<ITEM_TYPEasStream()
        Get the items in this sequence as a Stream.
        Returns:
        a stream containing all the items of the sequence
      • collect

        void collect()
        This optional operation ensures that a list is used to back this sequence.

        If a stream is currently backing this sequence, the stream will be collected into a list. This ensures the sequence can be visited multiple times.

      • isEmpty

        boolean isEmpty()
        Determine if this sequence is empty.
        Returns:
        true if the sequence contains no items, or false otherwise
      • size

        int size()
        Get the count of items in this sequence.
        Returns:
        the count of items