`
messi_18
  • 浏览: 96577 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

default set type in Groovy

 
阅读更多
println(([1] as Set).class)
do you know the class of this set. May be you think it's HashSet. The anwser is no, it's LinkedHashSet. That's to say it can keep insert order. I think it's convenient to use this as default. But you have to keep it in mind that this is not the most efficient choice. If you don't care insert order, you can use HashSet like this:
[1] as HashSet

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics