org.op4j.operators.qualities
Interface ConvertibleToMapOperator<T>

All Known Subinterfaces:
ILevel0ArrayOperator<I,T>, ILevel0IndefiniteArrayOperator<I,T>, ILevel0ListOperator<I,T>, ILevel0SetOperator<I,T>
All Known Implementing Classes:
Level0ArrayOperator, Level0ArrayOperator, Level0IndefiniteArrayOperator, Level0ListOperator, Level0ListOperator, Level0SetOperator, Level0SetOperator

public interface ConvertibleToMapOperator<T>

This interface contains methods for conversions to map.

Since:
1.0
Author:
Daniel Fernández

Method Summary
 Operator couple()
           Converts the target object to a map, by using the even elements (starting at 0) as keys, and the odd elements as values.
<K,V> Operator
toMap(IFunction<? super T,K> keyFunction, IFunction<? super T,V> valueFunction)
           Converts the target object to a map by inputting the original target's elements into the specified functions, which will create the resulting keys and values.
<K,V> Operator
toMap(IFunction<? super T,Map.Entry<K,V>> mapBuilder)
           Converts the target object to a map by inputting the original target's elements into the specified map builder (a function returning map entries) which will create the resulting keys and values.
<K> Operator
zipKeys(K... keys)
           Converts the target object to a map by using the original target's elements as values and setting the specified objects as keys.
<K> Operator
zipKeysBy(IFunction<? super T,K> keyEval)
           Converts the target object to a map by using the original target's elements as values and applying an evaluator (keyEval) to them in order to obtain their corresponding keys.
<K> Operator
zipKeysFrom(Collection<K> keys)
           Converts the target object to a map by using the original target's elements as values and setting the specified objects as keys.
<K> Operator
zipKeysFrom(K[] keys)
           Converts the target object to a map by using the original target's elements as values and setting the specified objects as keys.
<V> Operator
zipValues(V... values)
           Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.
<V> Operator
zipValuesBy(IFunction<? super T,V> valueEval)
           Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.
<V> Operator
zipValuesFrom(Collection<V> values)
           Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.
<V> Operator
zipValuesFrom(V[] values)
           Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.
 

Method Detail

couple

Operator couple()

Converts the target object to a map, by using the even elements (starting at 0) as keys, and the odd elements as values.

Returns:
an operator holding the converted object as target.

zipKeysBy

<K> Operator zipKeysBy(IFunction<? super T,K> keyEval)

Converts the target object to a map by using the original target's elements as values and applying an evaluator (keyEval) to them in order to obtain their corresponding keys.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
K - the type of the keys that will be created
Parameters:
keyEval - the evaluator used for obtaining the keys
Returns:
an operator holding the converted object as target.

zipValuesBy

<V> Operator zipValuesBy(IFunction<? super T,V> valueEval)

Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
V - the type of the values that will be created
Parameters:
valueEval - the evaluator used for obtaining the values
Returns:
an operator holding the converted object as target.

zipKeys

<K> Operator zipKeys(K... keys)

Converts the target object to a map by using the original target's elements as values and setting the specified objects as keys.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
K - the type of the keys
Parameters:
keys - the new keys
Returns:
an operator holding the converted object as target.

zipValues

<V> Operator zipValues(V... values)

Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.

Type Parameters:
V - the type of the values
Parameters:
values - the new values
Returns:
an operator holding the converted object as target.

zipKeysFrom

<K> Operator zipKeysFrom(Collection<K> keys)

Converts the target object to a map by using the original target's elements as values and setting the specified objects as keys.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
K - the type of the keys
Parameters:
keys - the new keys
Returns:
an operator holding the converted object as target.

zipValuesFrom

<V> Operator zipValuesFrom(Collection<V> values)

Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.

Type Parameters:
V - the type of the values
Parameters:
values - the new values
Returns:
an operator holding the converted object as target.

zipKeysFrom

<K> Operator zipKeysFrom(K[] keys)

Converts the target object to a map by using the original target's elements as values and setting the specified objects as keys.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
K - the type of the keys
Parameters:
keys - the new keys
Returns:
an operator holding the converted object as target.

zipValuesFrom

<V> Operator zipValuesFrom(V[] values)

Converts the target object to a map by using the original target's elements as keys and applying an evaluator (valueEval) to them in order to obtain their corresponding value.

Type Parameters:
V - the type of the values
Parameters:
values - the new values
Returns:
an operator holding the converted object as target.

toMap

<K,V> Operator toMap(IFunction<? super T,Map.Entry<K,V>> mapBuilder)

Converts the target object to a map by inputting the original target's elements into the specified map builder (a function returning map entries) which will create the resulting keys and values.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
K - the type of the keys that will be created
V - the type of the values that will be created
Parameters:
mapBuilder - the map builder function to be used
Returns:
an operator holding the converted object as target.

toMap

<K,V> Operator toMap(IFunction<? super T,K> keyFunction,
                     IFunction<? super T,V> valueFunction)

Converts the target object to a map by inputting the original target's elements into the specified functions, which will create the resulting keys and values.

Note that if more than one value get the same key, only the last one will be in the resulting map (the other ones will be overwritten).

Type Parameters:
K - the type of the keys that will be created
V - the type of the values that will be created
Parameters:
keyFunction - the function for building the keys
valueFunction - the function for building the values
Returns:
an operator holding the converted object as target.


Copyright © 2012 The OP4J team. All Rights Reserved.