Groovy as a list of questions

I came across this piece of code, and it seems to me that it is not needed, is there any reason to do the following

def answers = [] as List 

instead

 def answers = [] 

In groovy, I thought that [] was an empty list, so there is no need to have as List

+6
source share
1 answer

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

+7
source

Source: https://habr.com/ru/post/887833/


All Articles