Is there an idiomatic way to take a Set
and a Function
, and get a Map
live view? (i.e. the Map
For the non live view the code exists in lambdaJ with Lambda.map(Set, Converter)
.
Set setKs = new Set();
Converter converterKv = new Converter{
@Override
public V convert(K from){
return null; //Not useful here but you can do whatever you want
}
}
Map mapKvs = Lambda.map(setKs, converterKv);
I tried my own implementation : http://ideone.com/Kkpcn
As said in the comments, I have to extends another class so I just implemented Map
, that's why there is so much code.
There is a totally useless (or not ?) feature that allows you to change the converter on the fly.