开发者

Groovy as List Question

I ran across this bit of code and to me it seems like its not needed is there any reason to do the following

def answers = [] as List

instead of

def answers = []

In groovy I though开发者_如何学Pythont that [] was the empty list so there would be no need to have the as List


No, there is no difference, both create an ArrayList and List (java.util.List) is an interface anyway.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜