Class OnePlusList<T>

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

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

      • OnePlusList

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