Interface ImList<E>

    • Method Detail

      • append

        @NotNull
        @NotNull ImList<E> append​(E e)
        Returns a new BaseList with the additional item at the end.
        Specified by:
        append in interface BaseList<E>
        Parameters:
        e - the value to append
      • appendSome

        @Contract(pure=true)
        @NotNull
        default @NotNull ImList<E> appendSome​(@NotNull
                                              @NotNull Fn0<? extends @NotNull Option<E>> supplier)
        If supplier returns Some, return a new BaseList with the additional item at the end. If None, just return this BaseList unmodified.
        Specified by:
        appendSome in interface BaseList<E>
        Parameters:
        supplier - return Option.Some to append, None for a no-op.
      • concat

        @Contract(pure=true)
        @NotNull
        default @NotNull ImList<E> concat​(@Nullable
                                          @Nullable Iterable<? extends E> es)
        Efficiently adds items to the end of this ImList.
        Specified by:
        concat in interface BaseList<E>
        Specified by:
        concat in interface Transformable<E>
        Specified by:
        concat in interface UnmodIterable<E>
        Parameters:
        es - the values to insert
        Returns:
        a new ImList with the additional items at the end.
      • mutable

        @NotNull
        @NotNull MutList<E> mutable()
        Returns a mutable list (builder)
      • replace

        @Contract(pure=true)
        @NotNull
        @NotNull ImList<E> replace​(int idx,
                                   E e)
        Replace the item at the given index. Note: i.replace(i.size(), o) used to be equivalent to i.concat(o), but it probably won't be for the RRB tree implementation, so this will change too.
        Specified by:
        replace in interface BaseList<E>
        Parameters:
        idx - the index where the value should be stored.
        e - the value to store
        Returns:
        a new ImList with the replaced item
      • reverse

        @NotNull
        default @NotNull ImList<E> reverse()
        Returns a reversed copy of this list.
        Specified by:
        reverse in interface BaseList<E>