Class KeyedCollection<K,​V>

  • All Implemented Interfaces:
    Iterable<V>, Collection<V>
    Direct Known Subclasses:
    LocalCollection

    public class KeyedCollection<K,​V>
    extends AbstractCollection<V>
    A KeyedCollection is a light weight wrapper around a Map (LinkedHashMap) values set. When a value is added using the add method of this class a key is obtained for the value using either the provided KeyExtractor, or if no KeyExtractor was provided, the value is cast to Keyable and the getKey() method is called. The underlying Map can be obtainded with the toMap method. Any changes to this map are directly reflected in this collection. Additions to the map do not need to implement Keyable, nor do the values need to be keyed using the key returned from the KeyExtractor.getKey(value) or the key returned from the Keyable.getKey() Method.
    • Constructor Detail

      • KeyedCollection

        public KeyedCollection()
      • KeyedCollection

        public KeyedCollection​(KeyExtractor<? extends K,​? super V> keyExtractor)
      • KeyedCollection

        public KeyedCollection​(Collection<? extends V> c)
      • KeyedCollection

        public KeyedCollection​(int initialCapacity)