Stas Kurilin Stas Kurilin - 4 months ago 19
Java Question

Is there a bidirectional function in Guava?

So, I need function with API like

interface BiFunction<A, B> {
B aToB(A input);
A bToA(B input);
}


Does Guava provided smt like this. If no, what names you would suggest for
aToB
/
bToA
methods?

Answer

No, there isn't anything like this in Guava currently. Something like it may be coming (see this issue, as well as this issue for some related discussion).

For names, I don't know what would be best but I'd prefer something like apply and applyInverse over aToB and bToA.