Class KeyCollection<E>

  • Type Parameters:
    E - type of elements stored in the collection
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, ICollection<E>
    Direct Known Subclasses:
    KeySet

    public class KeyCollection<E>
    extends KeyCollectionImpl<E>
    KeyCollection implements a collection. It can provide fast access to its elements like a Set. The elements allowed in the collection can be constraint (null/duplicate values).
    See Also:
    Key1List, Serialized Form
    • Constructor Detail

      • KeyCollection

        protected KeyCollection()
        Protected constructor used by builder or derived collections.
    • Method Detail

      • crop

        public KeyCollection<E> crop()
        Description copied from class: KeyCollectionImpl
        Returns a copy of this collection but without elements. The new collection will use the same comparator, ordering, etc.
        Specified by:
        crop in interface ICollection<E>
        Overrides:
        crop in class KeyCollectionImpl<E>
        Returns:
        an empty copy of this collection
      • put

        public E put​(E elem)
        Description copied from class: KeyCollectionImpl
        Adds or replaces element. If there is no such element, the element is added. If there is such an element, the element is replaced. So said simply, it is a shortcut for the following code:
         remove(elem);
         add(elem);
         
        However the method is atomic in the sense that all or none operations are executed. So if there is already such an element, but adding the new one fails due to a constraint violation, the old element remains in the list.
        Overrides:
        put in class KeyCollectionImpl<E>
        Parameters:
        elem - element
        Returns:
        element which has been replaced or null otherwise
      • invalidate

        public void invalidate​(E elem)
        Description copied from class: KeyCollectionImpl
        Invalidate element, i.e. all keys of the element are extracted again and stored in the key maps. Old key values are removed if needed. You must call an invalidate method if an element's key value has changed after adding it to the collection.
        Overrides:
        invalidate in class KeyCollectionImpl<E>
        Parameters:
        elem - element to invalidate
      • filter

        public KeyCollection<E> filter​(java.util.function.Predicate<? super E> filter)
        Description copied from interface: ICollection
        Create a new collection by applying the specified filter to all elements. The returned collection has the same type as the original one.
        Specified by:
        filter in interface ICollection<E>
        Overrides:
        filter in class KeyCollectionImpl<E>
        Parameters:
        filter - filter predicate
        Returns:
        created list