Class PropertySingleton<V>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<V>
org.apache.sis.feature.PropertySingleton<V>
All Implemented Interfaces:
Iterable<V>, Collection<V>, List<V>

final class PropertySingleton<V> extends AbstractList<V>
A list containing 0 or 1 value. This implementation is used in the very common case where a AbstractAttribute accepts at most one value. Its main purpose is to reduce the amount of objects in memory compared to ArrayList.

There is no need to keep long-lived references to instances of this class. Instances can be recreated when needed.

Since:
0.5
Version:
0.5
  • Field Details

    • property

      private final Field<V> property
      The property where to read and write the value.
  • Constructor Details

    • PropertySingleton

      PropertySingleton(Field<V> property)
      Creates a new list for the value of the given property.
  • Method Details