Why Collectors.toCollection() is less efficient than Constructing Directly via the Collection Constructor

后端 未结 0 1733
南笙
南笙 2020-12-14 07:52

I ran the below two code snippets through profilers and it turned out Sample 2 consumes a bit less memory and ran a bit faster. My intuition is the compiler should optimize

相关标签:
回答
  • 消灭零回复
提交回复
热议问题