Class ListPlusOne<T>

  • Type Parameters:
    T - Type of the list items.
    All Implemented Interfaces:
    Iterable<T>, Collection<T>, List<T>, RandomAccess

    public final class ListPlusOne<T>
    extends AbstractList<T>
    implements RandomAccess
    An unmodifiable list that extends another list and includes an additional item at the end.
    Since:
    8.4.0
    • Constructor Detail

      • ListPlusOne

        public ListPlusOne​(List<T> head,
                           T tail)
        Constructs a new list that includes the specified end item at the end of another list. If the end item is null, this will not affect the size, i.e. the resulting list will have a null element at the end position.
        Parameters:
        tail - The item to be placed at the end of the list.
        head - The parent list to be included after the start item.