When doing this
Stream.of(1, 32, 12, 15, 23).map(Integer::toString);
I get an ambiguous type error. Understandably, the compiler can't tell if I mean toString(int)
or toString()
from Integer
.
When not using a method reference, I might have gotten out of this with an explicit cast or write out the generics long hand, but how can I let the compiler know what I mean here? What syntax (if any) can I use to make in unambiguous?