Questions tagged «java-stream»

21
ජාවා 8 ලැයිස්තුව <V> සිතියමට <K, V>
ජාවා 8 හි ධාරාවන් සහ ලැම්බඩාස් භාවිතා කරමින් සිතියමකට වස්තු ලැයිස්තුවක් පරිවර්තනය කිරීමට මට අවශ්‍යය. ජාවා 7 සහ ඊට පහළින් මම එය ලියන්නේ එලෙසයි. private Map&lt;String, Choice&gt; nameMap(List&lt;Choice&gt; choices) { final Map&lt;String, Choice&gt; hashMap = new HashMap&lt;&gt;(); for (final Choice choice : choices) { hashMap.put(choice.getName(), choice); } return hashMap; } …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.