org.op4j.operators.qualities
Interface ModifiableMapOperator<K,V>

All Known Subinterfaces:
ILevel0BuildingMapOperator<I,K,V>, ILevel0MapOperator<I,K,V>, ILevel0MapSelectedOperator<I,K,V>
All Known Implementing Classes:
Level0BuildingMapOperator, Level0MapOperator, Level0MapOperator, Level0MapSelectedOperator, Level0MapSelectedOperator

public interface ModifiableMapOperator<K,V>

This interface contains methods for modifying maps (adding/removing elements).

Since:
1.0
Author:
Daniel Fernández

Method Summary
 ModifiableMapOperator<K,V> insert(int position, K newKey, V newValue)
           Inserts a new entry with the specified key and value into the specified position (starting in 0) of the target map.
 ModifiableMapOperator<K,V> insertAll(int position, Map<K,V> map)
           Inserts all the entries in the specified map to the target map, in the specified position.
 ModifiableMapOperator<K,V> put(K newKey, V newValue)
           Adds a new entry with the specified key and value at the end of the target map.
 ModifiableMapOperator<K,V> putAll(Map<K,V> map)
           Adds all the entries in the specified map to the target map.
 ModifiableMapOperator<K,V> removeAllFalse(IFunction<? super Map.Entry<K,V>,Boolean> eval)
           Removes from the target map all the entries which evaluate as false using the specified evaluator.
 ModifiableMapOperator<K,V> removeAllKeys(K... keys)
           Removes from the target map all entries which keys match the ones specified.
 ModifiableMapOperator<K,V> removeAllKeysNot(K... keys)
           Removes from the target map all entries except those which keys match the ones specified.
 ModifiableMapOperator<K,V> removeAllTrue(IFunction<? super Map.Entry<K,V>,Boolean> eval)
           Removes from the target map all the entries which evaluate as true using the specified evaluator.
 

Method Detail

put

ModifiableMapOperator<K,V> put(K newKey,
                               V newValue)

Adds a new entry with the specified key and value at the end of the target map.

The original target object is not modified, but copied instead.

Parameters:
newKey - the key for the new entry to be added
newValue - the value for the new entry to be added
Returns:
an operator holding the modified map

insert

ModifiableMapOperator<K,V> insert(int position,
                                  K newKey,
                                  V newValue)

Inserts a new entry with the specified key and value into the specified position (starting in 0) of the target map.

The original target object is not modified, but copied instead.

Parameters:
position - the position into which the new entry will be inserted
newKey - the key for the new entry to be insert
newValue - the value for the new entry to be insert
Returns:
an operator holding the modified map

putAll

ModifiableMapOperator<K,V> putAll(Map<K,V> map)

Adds all the entries in the specified map to the target map.

The original target object is not modified, but copied instead.

Parameters:
map - the map containing the entries to be added.
Returns:
an operator holding the modified map

insertAll

ModifiableMapOperator<K,V> insertAll(int position,
                                     Map<K,V> map)

Inserts all the entries in the specified map to the target map, in the specified position.

The original target object is not modified, but copied instead.

Parameters:
position - the position into which the entries will be added.
map - the map containing the entries to be inserted.
Returns:
an operator holding the modified map

removeAllKeys

ModifiableMapOperator<K,V> removeAllKeys(K... keys)

Removes from the target map all entries which keys match the ones specified.

The original target object is not modified, but copied instead.

Parameters:
keys - the keys which have to be removed.
Returns:
an operator holding the modified map

removeAllTrue

ModifiableMapOperator<K,V> removeAllTrue(IFunction<? super Map.Entry<K,V>,Boolean> eval)

Removes from the target map all the entries which evaluate as true using the specified evaluator.

The original target object is not modified, but copied instead.

Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified map

removeAllFalse

ModifiableMapOperator<K,V> removeAllFalse(IFunction<? super Map.Entry<K,V>,Boolean> eval)

Removes from the target map all the entries which evaluate as false using the specified evaluator.

The original target object is not modified, but copied instead.

Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified map

removeAllKeysNot

ModifiableMapOperator<K,V> removeAllKeysNot(K... keys)

Removes from the target map all entries except those which keys match the ones specified.

The original target object is not modified, but copied instead.

Parameters:
keys - the keys which have to be kept.
Returns:
an operator holding the modified map


Copyright © 2012 The OP4J team. All Rights Reserved.