|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.op4j.operators.impl.AbstractOperator org.op4j.operators.impl.fn.map.Level0MapOperator<I,K,V>
public final class Level0MapOperator<I,K,V>
Constructor Summary | |
---|---|
Level0MapOperator(Target target)
|
Method Summary | ||
---|---|---|
Level0GenericUniqOperator<I,Boolean> |
all(IFunction<? super Map.Entry<K,V>,Boolean> eval)
|
|
Level0GenericUniqOperator<I,Boolean> |
any(IFunction<? super Map.Entry<K,V>,Boolean> eval)
|
|
|
castToMapOf(org.javaruntype.type.Type<X> keyType,
org.javaruntype.type.Type<Y> valueType)
Casts the operator's target as a map of the specified types. |
|
|
exec(IFunction<? super Map<K,V>,X> function)
Executes the specified function on the target object, creating a new generic operator containing the result of the execution and setting the new operator type to the one specified. |
|
|
execAsMap(IFunction<? super Map<K,V>,? extends Map<X,Y>> function)
Executes the specified function on the target map, creating a new map operator containing the result of the execution. |
|
Level0MapOperator<I,K,V> |
execIfFalseAsMap(IFunction<? super Map<K,V>,Boolean> eval,
IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
|
execIfFalseAsMap(IFunction<? super Map<K,V>,Boolean> eval,
IFunction<? super Map<K,V>,? extends Map<X,Y>> function,
IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
Level0MapOperator<I,K,V> |
execIfNotNullAsMap(IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
|
execIfNotNullAsMap(IFunction<? super Map<K,V>,? extends Map<X,Y>> function,
IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
Level0MapOperator<I,K,V> |
execIfNullAsMap(IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
|
execIfNullAsMap(IFunction<? super Map<K,V>,? extends Map<X,Y>> function,
IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
Level0MapOperator<I,K,V> |
execIfTrueAsMap(IFunction<? super Map<K,V>,Boolean> eval,
IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
|
execIfTrueAsMap(IFunction<? super Map<K,V>,Boolean> eval,
IFunction<? super Map<K,V>,? extends Map<X,Y>> function,
IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction) but only
on selected elements, leaving all other elements untouched. |
|
Level0SetOperator<I,K> |
extractKeys()
Extracts only the keys of the map (discarding values) and creates an operator which will hold these keys as a target object of type Set. |
|
Level0ListOperator<I,V> |
extractValues()
Extracts only the values of the map (discarding keys) and creates an operator which will hold these values as a target object of type List. |
|
Level1MapEntriesOperator<I,K,V> |
forEachEntry()
Iterates the target map's entries. |
|
Level0GenericUniqOperator<I,Map<K,V>> |
generic()
Converts the specialized structure operator into generic operators (with no specific methods for structures - e.g. forEach()) |
|
Function<I,Map<K,V>> |
get()
Returns a function which will execute all the logic specified from the "Fn.on" expression. |
|
Level0MapSelectedOperator<I,K,V> |
ifFalse(IFunction<? super Map<K,V>,Boolean> eval)
Selects only those targets for which the specified evaluator returns false. |
|
Level0MapSelectedOperator<I,K,V> |
ifNotNull()
Selects only those targets which are not null. |
|
Level0MapSelectedOperator<I,K,V> |
ifNull()
Selects only those targets which are null. |
|
Level0MapSelectedOperator<I,K,V> |
ifTrue(IFunction<? super Map<K,V>,Boolean> eval)
Selects only those targets for which the specified evaluator returns true. |
|
Level0MapOperator<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. |
|
Level0MapOperator<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. |
|
|
of(org.javaruntype.type.Type<X> keyType,
org.javaruntype.type.Type<Y> valueType)
Casts the operator's target as a map of the specified types. |
|
Level0MapOperator<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. |
|
Level0MapOperator<I,K,V> |
putAll(Map<K,V> map)
Adds all the entries in the specified map to the target map. |
|
Level0MapOperator<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. |
|
Level0MapOperator<I,K,V> |
removeAllKeys(K... keys)
Removes from the target map all entries which keys match the ones specified. |
|
Level0MapOperator<I,K,V> |
removeAllKeysNot(K... keys)
Removes from the target map all entries except those which keys match the ones specified. |
|
Level0MapOperator<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. |
|
Level0MapOperator<I,K,V> |
replaceIfNullWith(Map<K,V> replacement)
Replaces the current target object with the specified replacement if the current target is null. |
|
Level0MapOperator<I,K,V> |
replaceWith(Map<K,V> replacement)
Replaces the current target object with the specified replacement. |
|
Level0MapOperator<I,K,V> |
reverse()
Reverses the elements of the structure. |
|
Level0MapOperator<I,K,V> |
sort()
Sorts the elements of the structure according to their natural ordering. |
|
Level0MapOperator<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. |
|
Level0MapOperator<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. |
Methods inherited from class org.op4j.operators.impl.AbstractOperator |
---|
getTarget |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Level0MapOperator(Target target)
Method Detail |
---|
public Level0SetOperator<I,K> extractKeys()
ExtractableMapOperator
Extracts only the keys of the map (discarding values) and creates an operator which will hold these keys as a target object of type Set.
extractKeys
in interface ILevel0MapOperator<I,K,V>
extractKeys
in interface ExtractableMapOperator<K,V>
public Level0ListOperator<I,V> extractValues()
ExtractableMapOperator
Extracts only the values of the map (discarding keys) and creates an operator which will hold these values as a target object of type List.
extractValues
in interface ILevel0MapOperator<I,K,V>
extractValues
in interface ExtractableMapOperator<K,V>
public Level1MapEntriesOperator<I,K,V> forEachEntry()
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.
forEachEntry
in interface ILevel0MapOperator<I,K,V>
forEachEntry
in interface NavigableMapOperator<K,V>
public Level0MapOperator<I,K,V> put(K newKey, V newValue)
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.
put
in interface ILevel0MapOperator<I,K,V>
put
in interface ModifiableMapOperator<K,V>
newKey
- the key for the new entry to be addednewValue
- the value for the new entry to be added
public Level0MapOperator<I,K,V> insert(int position, K newKey, V newValue)
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.
insert
in interface ILevel0MapOperator<I,K,V>
insert
in interface ModifiableMapOperator<K,V>
position
- the position into which the new entry will be insertednewKey
- the key for the new entry to be insertnewValue
- the value for the new entry to be insert
public Level0MapOperator<I,K,V> putAll(Map<K,V> map)
ModifiableMapOperator
Adds all the entries in the specified map to the target map.
The original target object is not modified, but copied instead.
putAll
in interface ILevel0MapOperator<I,K,V>
putAll
in interface ModifiableMapOperator<K,V>
map
- the map containing the entries to be added.
public Level0MapOperator<I,K,V> insertAll(int position, Map<K,V> map)
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.
insertAll
in interface ILevel0MapOperator<I,K,V>
insertAll
in interface ModifiableMapOperator<K,V>
position
- the position into which the entries will be added.map
- the map containing the entries to be inserted.
public Level0MapOperator<I,K,V> removeAllKeys(K... keys)
ModifiableMapOperator
Removes from the target map all entries which keys match the ones specified.
The original target object is not modified, but copied instead.
removeAllKeys
in interface ILevel0MapOperator<I,K,V>
removeAllKeys
in interface ModifiableMapOperator<K,V>
keys
- the keys which have to be removed.
public Level0MapOperator<I,K,V> removeAllTrue(IFunction<? super Map.Entry<K,V>,Boolean> eval)
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.
removeAllTrue
in interface ILevel0MapOperator<I,K,V>
removeAllTrue
in interface ModifiableMapOperator<K,V>
eval
- the evaluator to be used, which must return Boolean
public Level0MapOperator<I,K,V> removeAllFalse(IFunction<? super Map.Entry<K,V>,Boolean> eval)
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.
removeAllFalse
in interface ILevel0MapOperator<I,K,V>
removeAllFalse
in interface ModifiableMapOperator<K,V>
eval
- the evaluator to be used, which must return Boolean
public Level0MapOperator<I,K,V> removeAllKeysNot(K... keys)
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.
removeAllKeysNot
in interface ILevel0MapOperator<I,K,V>
removeAllKeysNot
in interface ModifiableMapOperator<K,V>
keys
- the keys which have to be kept.
public Level0MapOperator<I,K,V> sort()
SortableOperator
Sorts the elements of the structure according to their natural ordering.
sort
in interface ILevel0MapOperator<I,K,V>
sort
in interface SortableOperator<Map.Entry<K,V>>
public Level0MapOperator<I,K,V> sort(Comparator<? super Map.Entry<K,V>> comparator)
SortableOperator
Sorts the elements of the structure according to the order induced by the specified comparator.
sort
in interface ILevel0MapOperator<I,K,V>
sort
in interface SortableOperator<Map.Entry<K,V>>
comparator
- the comparator to be used.
public Function<I,Map<K,V>> get()
UniqFnOperator
Returns a function which will execute all the logic specified from the "Fn.on" expression.
get
in interface UniqFnOperator<I,Map<K,V>>
public Level0GenericUniqOperator<I,Map<K,V>> generic()
GenerizableOperator
Converts the specialized structure operator into generic operators (with no specific methods for structures - e.g. forEach())
generic
in interface ILevel0MapOperator<I,K,V>
generic
in interface GenerizableOperator<I,Map<K,V>>
public <X,Y> Level0MapOperator<I,X,Y> of(org.javaruntype.type.Type<X> keyType, org.javaruntype.type.Type<Y> valueType)
CastableToMapOperator
Casts the operator's target as a map of the specified types.
of
in interface ILevel0MapOperator<I,K,V>
of
in interface CastableToMapOperator
X
- the type for the map's keysY
- the type for the map's valueskeyType
- the type for the map's keysvalueType
- the type for the map's values
public <X,Y> Level0MapOperator<I,X,Y> castToMapOf(org.javaruntype.type.Type<X> keyType, org.javaruntype.type.Type<Y> valueType)
CastableToMapOperator
Casts the operator's target as a map of the specified types.
castToMapOf
in interface ILevel0MapOperator<I,K,V>
castToMapOf
in interface CastableToMapOperator
X
- the type for the map's keysY
- the type for the map's valueskeyType
- the type for the map's keysvalueType
- the type for the map's values
public Level0MapSelectedOperator<I,K,V> ifTrue(IFunction<? super Map<K,V>,Boolean> eval)
SelectableOperator
Selects only those targets for which the specified evaluator returns true. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.
ifTrue
in interface ILevel0MapOperator<I,K,V>
ifTrue
in interface SelectableOperator<Map<K,V>>
eval
- the evaluator to be used for selecting targets.
public Level0MapSelectedOperator<I,K,V> ifFalse(IFunction<? super Map<K,V>,Boolean> eval)
SelectableOperator
Selects only those targets for which the specified evaluator returns false. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.
ifFalse
in interface ILevel0MapOperator<I,K,V>
ifFalse
in interface SelectableOperator<Map<K,V>>
eval
- the evaluator to be used for selecting targets.
public Level0MapSelectedOperator<I,K,V> ifNotNull()
SelectableOperator
Selects only those targets which are not null. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.
ifNotNull
in interface ILevel0MapOperator<I,K,V>
ifNotNull
in interface SelectableOperator<Map<K,V>>
public Level0MapSelectedOperator<I,K,V> ifNull()
SelectableOperator
Selects only those targets which are null. After this method, all the subsequently executed operations will only be executed on the target objects selected here, until an "endIf()" method is called.
ifNull
in interface ILevel0MapOperator<I,K,V>
ifNull
in interface SelectableOperator<Map<K,V>>
public <X,Y> Level0MapOperator<I,X,Y> execAsMap(IFunction<? super Map<K,V>,? extends Map<X,Y>> function)
ExecutableMapOperator
Executes the specified function on the target map, creating a new map operator containing the result of the execution.
This function must be able to take as input an object of the current operator's target type, and will return an object of a different type but same structure, which will be from then on the new operator's target type.
execAsMap
in interface ILevel0MapOperator<I,K,V>
execAsMap
in interface ExecutableMapOperator<K,V>
X
- the type of the resulting keysY
- the type of the resulting valuesfunction
- the function to be executed
public <X> Level0GenericUniqOperator<I,X> exec(IFunction<? super Map<K,V>,X> function)
ExecutableMapOperator
Executes the specified function on the target object, creating a new generic operator containing the result of the execution and setting the new operator type to the one specified.
exec
in interface ILevel0MapOperator<I,K,V>
exec
in interface ExecutableMapOperator<K,V>
X
- the type of the result objectfunction
- the function to be executed
public Level0MapOperator<I,K,V> replaceWith(Map<K,V> replacement)
ReplaceableOperator
Replaces the current target object with the specified replacement.
replaceWith
in interface ILevel0MapOperator<I,K,V>
replaceWith
in interface ReplaceableOperator<Map<K,V>>
replacement
- the object which will replace the current target object.
public Level0MapOperator<I,K,V> replaceIfNullWith(Map<K,V> replacement)
ReplaceableIfNullOperator
Replaces the current target object with the specified replacement if the current target is null.
replaceIfNullWith
in interface ILevel0MapOperator<I,K,V>
replaceIfNullWith
in interface ReplaceableIfNullOperator<Map<K,V>>
replacement
- the object which will replace the current target object if target is null.
public Level0GenericUniqOperator<I,Boolean> all(IFunction<? super Map.Entry<K,V>,Boolean> eval)
all
in interface ILevel0MapOperator<I,K,V>
all
in interface TotalizableOperator<I,Map.Entry<K,V>>
public Level0GenericUniqOperator<I,Boolean> any(IFunction<? super Map.Entry<K,V>,Boolean> eval)
any
in interface ILevel0MapOperator<I,K,V>
any
in interface TotalizableOperator<I,Map.Entry<K,V>>
public Level0MapOperator<I,K,V> sortBy(IFunction<? super Map.Entry<K,V>,?> by)
SortableOperator
Sorts the elements of the structure according to the result of executing the specified function.
sortBy
in interface ILevel0MapOperator<I,K,V>
sortBy
in interface SortableOperator<Map.Entry<K,V>>
by
- the function to be executed in order to obtain the compared object
public Level0MapOperator<I,K,V> reverse()
ReversibleOperator
Reverses the elements of the structure.
reverse
in interface ILevel0MapOperator<I,K,V>
reverse
in interface ReversibleOperator<Map.Entry<K,V>>
public Level0MapOperator<I,K,V> execIfFalseAsMap(IFunction<? super Map<K,V>,Boolean> eval, IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfFalseAsMap
in interface ILevel0MapOperator<I,K,V>
execIfFalseAsMap
in interface ExecutableMapOperator<K,V>
eval
- the evaluation function used to select elementsfunction
- the function to be executed on the selected elements
public <X,Y> Level0MapOperator<I,X,Y> execIfFalseAsMap(IFunction<? super Map<K,V>,Boolean> eval, IFunction<? super Map<K,V>,? extends Map<X,Y>> function, IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfFalseAsMap
in interface ILevel0MapOperator<I,K,V>
execIfFalseAsMap
in interface ExecutableMapOperator<K,V>
X
- the new type of the keys returned by the functionsY
- the new type of the values returned by the functionseval
- the evaluation function used to select elementsfunction
- the function to be executed on the selected elementselseFunction
- the function to be executed on the non-selected elements
public Level0MapOperator<I,K,V> execIfNotNullAsMap(IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfNotNullAsMap
in interface ILevel0MapOperator<I,K,V>
execIfNotNullAsMap
in interface ExecutableMapOperator<K,V>
function
- the function to be executed on the selected elements
public <X,Y> Level0MapOperator<I,X,Y> execIfNotNullAsMap(IFunction<? super Map<K,V>,? extends Map<X,Y>> function, IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfNotNullAsMap
in interface ILevel0MapOperator<I,K,V>
execIfNotNullAsMap
in interface ExecutableMapOperator<K,V>
X
- the new type of the keys returned by the functionsY
- the new type of the values returned by the functionsfunction
- the function to be executed on the selected elementselseFunction
- the function to be executed on the non-selected elements
public Level0MapOperator<I,K,V> execIfNullAsMap(IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfNullAsMap
in interface ILevel0MapOperator<I,K,V>
execIfNullAsMap
in interface ExecutableMapOperator<K,V>
function
- the function to be executed on the selected elements
public <X,Y> Level0MapOperator<I,X,Y> execIfNullAsMap(IFunction<? super Map<K,V>,? extends Map<X,Y>> function, IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfNullAsMap
in interface ILevel0MapOperator<I,K,V>
execIfNullAsMap
in interface ExecutableMapOperator<K,V>
X
- the new type of the keys returned by the functionsY
- the new type of the values returned by the functionsfunction
- the function to be executed on the selected elementselseFunction
- the function to be executed on the non-selected elements
public Level0MapOperator<I,K,V> execIfTrueAsMap(IFunction<? super Map<K,V>,Boolean> eval, IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfTrueAsMap
in interface ILevel0MapOperator<I,K,V>
execIfTrueAsMap
in interface ExecutableMapOperator<K,V>
eval
- the evaluation function used to select elementsfunction
- the function to be executed on the selected elements
public <X,Y> Level0MapOperator<I,X,Y> execIfTrueAsMap(IFunction<? super Map<K,V>,Boolean> eval, IFunction<? super Map<K,V>,? extends Map<X,Y>> function, IFunction<? super Map<K,V>,? extends Map<X,Y>> elseFunction)
ExecutableMapOperator
Executes a function in a way equivalent to ExecutableMapOperator.execAsMap(IFunction)
but only
on selected elements, leaving all other elements untouched.
execIfTrueAsMap
in interface ILevel0MapOperator<I,K,V>
execIfTrueAsMap
in interface ExecutableMapOperator<K,V>
X
- the new type of the keys returned by the functionsY
- the new type of the values returned by the functionseval
- the evaluation function used to select elementsfunction
- the function to be executed on the selected elementselseFunction
- the function to be executed on the non-selected elements
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |