Class SingleElementList<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.gigaspaces.internal.utils.collections.SingleElementList<E>
Type Parameters:
E - Element to hold in list.
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>

public final class SingleElementList<E> extends AbstractList<E>
An unmodifiable List holding a single element. Intended to simplify code dealing with a List that in some cases may hold only one element and in others multiple elements.
Since:
6.5
Author:
moran
  • Constructor Details

    • SingleElementList

      public SingleElementList(E element)
      Constructs a List holding one and only one element.
      Parameters:
      element - The element the list should hold.
  • Method Details