I\'ve created method whih numerating each character of alphabet. I\'m learning streams(functional programming) and try to use them as often as possible, but I don\'t know ho
It is better to use Function.identity() in place of i->i because as per answer for this question:
As of the current JRE implementation, Function.identity() will always return the same instance while each occurrence of identifier -> identifier will not only create its own instance but even have a distinct implementation class.
IntStream.range(0, alphabet.size())
.boxed()
.collect(toMap(alphabet::get, Function.identity()));