Interface CMap<K,​V>

    • Method Detail

      • getBaseValue

        default CMap<K,​V> getBaseValue()
        get the CMap of items
        Specified by:
        getBaseValue in interface CBaseState<K>
        Returns:
        the CMap to be used in related interface
      • asSet

        default CSet<java.util.Map.Entry<K,​V>> asSet()
        Returns a CSet view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, CSet.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
        Returns:
        CSet of the mappings contained in this map
      • keySet

        default CSet<K> keySet()
        Returns a CSet view of the keys contained in this map.
        Specified by:
        keySet in interface java.util.Map<K,​V>
        Returns:
        CSet of the mappings contained in this map
      • values

        default CList<V> values()
        Returns a CSet view of the keys contained in this map.
        Specified by:
        values in interface java.util.Map<K,​V>
        Returns:
        CSet of the mappings contained in this map
      • getFirstKeyByValue

        default K getFirstKeyByValue​(V value)
        Returns CCliItemCollection key of first element from map which its value match the predicate otherwise throw NoSuchElementException. The preferred alternative to this method is getFirst(BiPredicate), getAll(BiPredicate), getFirstValueByKey(Predicate) getAllValues(Predicate) getAllKeys(Predicate).
        Parameters:
        value - value to search for
        Returns:
        CCliItemCollection key of first element from map which matched the predicate otherwise return null.
        Throws:
        java.util.NoSuchElementException - in case no match found
      • getFirstKeyByValue

        default K getFirstKeyByValue​(java.util.function.Predicate<V> predicate)
        Returns CCliItemCollection key of first element from map which its value match the predicate otherwise throw NoSuchElementException. The preferred alternative to this method is getFirst(BiPredicate), getAll(BiPredicate), getFirstValueByKey(Predicate) getAllValues(Predicate) getAllKeys(Predicate).
        Parameters:
        predicate - tests against value
        Returns:
        CCliItemCollection key of first element from map which matched the predicate otherwise return null.
        Throws:
        java.util.NoSuchElementException - in case no match found
      • getFirstKeyByValueOrElse

        default K getFirstKeyByValueOrElse​(java.util.function.Predicate<V> predicate,
                                           K otherKey)
        Returns CCliItemCollection key of first element from map which its value match the predicate otherwise return otherKey. The preferred alternative to this method is getFirst(BiPredicate), getAll(BiPredicate), getFirstValueByKey(Predicate) getAllValues(Predicate) getAllKeys(Predicate).
        Parameters:
        predicate - tests against value
        otherKey - to return if no match found
        Returns:
        CCliItemCollection key of first element from map which matched the predicate otherwise return null.
      • getFirstValueByKey

        default V getFirstValueByKey​(java.util.function.Predicate<K> predicate)
        Returns CCliItemCollection value of first element from map which its key match the predicate otherwise throw NoSuchElementException. The preferred alternative to this method is getFirst(BiPredicate), getAll(BiPredicate), getFirstValueByKey(Predicate) getFirstKeyByValue(Predicate) getAllKeys(Predicate).
        Parameters:
        predicate - tests against key
        Returns:
        CCliItemCollection value of first element from map which matched the predicate otherwise return null.
        Throws:
        java.util.NoSuchElementException - if not match found
      • getFirstValueByKeyOrElse

        default V getFirstValueByKeyOrElse​(java.util.function.Predicate<K> predicate,
                                           V otherValue)
        Returns CCliItemCollection value of first element from map which its key match the predicate otherwise return otherValue. The preferred alternative to this method is getFirst(BiPredicate), getAll(BiPredicate), getFirstValueByKey(Predicate) getFirstKeyByValue(Predicate) getAllKeys(Predicate).
        Parameters:
        predicate - tests against key
        otherValue - to return in case if predicate did not match any value
        Returns:
        CCliItemCollection value of first element from map which matched the predicate otherwise return null.
      • getSortedMap

        default CLinkedMap<K,​V> getSortedMap​(java.util.Comparator<java.util.Map.Entry<K,​V>> comparator)
        Sorts the CMap according to the order induced by the specified comparator. Key and Value of all elements in the map must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw CCliItemCollection ClassCastException for any elements e1 and e2 in the list).

        This sort is guaranteed to be stable: equal elements will not be reordered as CCliItemCollection result of the sort.

        The specified list must be modifiable, but need not be resizable.

        Parameters:
        comparator - the comparator to determine the order of the list. A null value indicates that the elements' natural ordering should be used.
        Returns:
        CLinkedMap sorted based on defined comparator
        Throws:
        java.lang.ClassCastException - if the list contains elements that are not mutually comparable using the specified comparator.
        java.lang.UnsupportedOperationException - if the specified list's list-iterator does not support the set operation.
        java.lang.IllegalArgumentException - (optional) if the comparator is found to violate the Comparator contract
        See Also:
        ArrayList.sort(Comparator)