org.op4j.operators.intf.map
Interface ILevel0MapSelectedOperator<I,K,V>

All Superinterfaces:
ExecutableMapSelectedOperator<K,V>, ModifiableMapOperator<K,V>, NavigableMapOperator<K,V>, Operator, ReplaceableOperator<Map<K,V>>, SelectedOperator<Map<K,V>>, SortableOperator<Map.Entry<K,V>>, UniqOperator<Map<K,V>>
All Known Implementing Classes:
Level0MapSelectedOperator, Level0MapSelectedOperator

public interface ILevel0MapSelectedOperator<I,K,V>
extends UniqOperator<Map<K,V>>, NavigableMapOperator<K,V>, SortableOperator<Map.Entry<K,V>>, ExecutableMapSelectedOperator<K,V>, ReplaceableOperator<Map<K,V>>, ModifiableMapOperator<K,V>, SelectedOperator<Map<K,V>>

Since:
1.0
Author:
Daniel Fernández

Method Summary
 ILevel0MapOperator<I,K,V> endIf()
           Ends the selection currently active for this level.
 ILevel0MapSelectedOperator<I,K,V> execAsMap(IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
           Executes the specified function on the target object, creating a new map operator containing the result of the execution.
 ILevel1MapSelectedEntriesOperator<I,K,V> forEachEntry()
           Iterates the target map's entries.
 ILevel0MapSelectedOperator<I,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.
 ILevel0MapSelectedOperator<I,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.
 ILevel0MapSelectedOperator<I,K,V> put(K newKey, V newValue)
           Adds a new entry with the specified key and value at the end of the target map.
 ILevel0MapSelectedOperator<I,K,V> putAll(Map<K,V> map)
           Adds all the entries in the specified map to the target map.
 ILevel0MapSelectedOperator<I,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.
 ILevel0MapSelectedOperator<I,K,V> removeAllKeys(K... keys)
           Removes from the target map all entries which keys match the ones specified.
 ILevel0MapSelectedOperator<I,K,V> removeAllKeysNot(K... keys)
           Removes from the target map all entries except those which keys match the ones specified.
 ILevel0MapSelectedOperator<I,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.
 ILevel0MapSelectedOperator<I,K,V> replaceWith(Map<K,V> replacement)
           Replaces the current target object with the specified replacement.
 ILevel0MapSelectedOperator<I,K,V> sort()
           Sorts the elements of the structure according to their natural ordering.
 ILevel0MapSelectedOperator<I,K,V> sort(Comparator<? super Map.Entry<K,V>> comparator)
           Sorts the elements of the structure according to the order induced by the specified comparator.
 ILevel0MapSelectedOperator<I,K,V> sortBy(IFunction<? super Map.Entry<K,V>,?> by)
           Sorts the elements of the structure according to the result of executing the specified function.
 

Method Detail

endIf

ILevel0MapOperator<I,K,V> endIf()
Description copied from interface: SelectedOperator

Ends the selection currently active for this level.

Specified by:
endIf in interface SelectedOperator<Map<K,V>>
Returns:
an operator which will execute all subsequent operations on all the target objects instead of only on the previously selected ones.

forEachEntry

ILevel1MapSelectedEntriesOperator<I,K,V> forEachEntry()
Description copied from interface: NavigableMapOperator

Iterates the target map's entries. After executing this method, any further operations will be applied on each of the map entries (java.util.Map.Entry objects) until an "endFor()" method is called.

Specified by:
forEachEntry in interface NavigableMapOperator<K,V>
Returns:
an operator which will execute all operations on each entry of the map.

sort

ILevel0MapSelectedOperator<I,K,V> sort()
Description copied from interface: SortableOperator

Sorts the elements of the structure according to their natural ordering.

Specified by:
sort in interface SortableOperator<Map.Entry<K,V>>
Returns:
an operator containing the sorted structure as target object.

sort

ILevel0MapSelectedOperator<I,K,V> sort(Comparator<? super Map.Entry<K,V>> comparator)
Description copied from interface: SortableOperator

Sorts the elements of the structure according to the order induced by the specified comparator.

Specified by:
sort in interface SortableOperator<Map.Entry<K,V>>
Parameters:
comparator - the comparator to be used.
Returns:
an operator containing the sorted structure as target object.

sortBy

ILevel0MapSelectedOperator<I,K,V> sortBy(IFunction<? super Map.Entry<K,V>,?> by)
Description copied from interface: SortableOperator

Sorts the elements of the structure according to the result of executing the specified function.

Specified by:
sortBy in interface SortableOperator<Map.Entry<K,V>>
Parameters:
by - the function to be executed in order to obtain the compared object
Returns:
an operator containing the sorted structure as target object.

put

ILevel0MapSelectedOperator<I,K,V> put(K newKey,
                                      V newValue)
Description copied from interface: ModifiableMapOperator

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.

Specified by:
put in interface ModifiableMapOperator<K,V>
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

ILevel0MapSelectedOperator<I,K,V> insert(int position,
                                         K newKey,
                                         V newValue)
Description copied from interface: ModifiableMapOperator

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.

Specified by:
insert in interface ModifiableMapOperator<K,V>
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

ILevel0MapSelectedOperator<I,K,V> putAll(Map<K,V> map)
Description copied from interface: ModifiableMapOperator

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

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

Specified by:
putAll in interface ModifiableMapOperator<K,V>
Parameters:
map - the map containing the entries to be added.
Returns:
an operator holding the modified map

insertAll

ILevel0MapSelectedOperator<I,K,V> insertAll(int position,
                                            Map<K,V> map)
Description copied from interface: ModifiableMapOperator

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.

Specified by:
insertAll in interface ModifiableMapOperator<K,V>
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

ILevel0MapSelectedOperator<I,K,V> removeAllKeys(K... keys)
Description copied from interface: ModifiableMapOperator

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

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

Specified by:
removeAllKeys in interface ModifiableMapOperator<K,V>
Parameters:
keys - the keys which have to be removed.
Returns:
an operator holding the modified map

removeAllTrue

ILevel0MapSelectedOperator<I,K,V> removeAllTrue(IFunction<? super Map.Entry<K,V>,Boolean> eval)
Description copied from interface: ModifiableMapOperator

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.

Specified by:
removeAllTrue in interface ModifiableMapOperator<K,V>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified map

removeAllFalse

ILevel0MapSelectedOperator<I,K,V> removeAllFalse(IFunction<? super Map.Entry<K,V>,Boolean> eval)
Description copied from interface: ModifiableMapOperator

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.

Specified by:
removeAllFalse in interface ModifiableMapOperator<K,V>
Parameters:
eval - the evaluator to be used, which must return Boolean
Returns:
an operator holding the modified map

removeAllKeysNot

ILevel0MapSelectedOperator<I,K,V> removeAllKeysNot(K... keys)
Description copied from interface: ModifiableMapOperator

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.

Specified by:
removeAllKeysNot in interface ModifiableMapOperator<K,V>
Parameters:
keys - the keys which have to be kept.
Returns:
an operator holding the modified map

replaceWith

ILevel0MapSelectedOperator<I,K,V> replaceWith(Map<K,V> replacement)
Description copied from interface: ReplaceableOperator

Replaces the current target object with the specified replacement.

Specified by:
replaceWith in interface ReplaceableOperator<Map<K,V>>
Parameters:
replacement - the object which will replace the current target object.
Returns:
an operator containing the replacement object as target.

execAsMap

ILevel0MapSelectedOperator<I,K,V> execAsMap(IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
Description copied from interface: ExecutableMapSelectedOperator

Executes the specified function on the target object, creating a new map operator containing the result of the execution.

This function does not allow the operator target type to change because a selection ("if") has already been done on the target objects, and this would render the operator inconsistent (some objects would belong to a type and others to another type).

Specified by:
execAsMap in interface ExecutableMapSelectedOperator<K,V>
Parameters:
function - the function to be executed
Returns:
an operator on the results of function execution


Copyright © 2012 The OP4J team. All Rights Reserved.