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.
精彩评论