У меня есть Map<Pair<String, String>, Integer>
вот так:
Pair.left Pair.right Integer
1 A 10
1 B 20
2 C 30
Теперь, если я передам значение Pair.left как 1, тогда я должен получить Pair.right и это Integer на карте, например:
Map<String, Integer> :
A 10
B 20
If i pass 2,
then
C 30
Итак, я пробую это:
public Map<String, Integr> foo(Map<Pair<String, String>, Integer> input, String LeftValue)
{
Map<String, Integer> result = new HashMap();
Set<Pair<String, String>> inputKeysets = input.keySet();
//Now, I am thinking i will loop through the inputKeysets and see if the getLeft() matches the LeftValue, if it does then i will take the getRight() and store in a new Set
//Then i will have LeftValue and RightValue and then will compare again from the input and get the Integer value
}
Есть ли какой-нибудь простой способ сделать это из лямбды?