Yes, Array is a fixed-size data structure. It is declared as having a type that describes which elements it can contain; this type is covariant ( see here covariant or contravariant elements). Array knows its type at runtime, and trying to put something inappropriate in Array will throw an exception.
In Groovy, arrays are not completely idiomatic due to their low level and inflexibility (fixed size). They are supported for interacting with Java. Usually people using Groovy prefer List Array . Groovy is trying to smooth out the differences, for example, you can use the size method in Array to get the number of elements (even if you have to use the length property in Java).
(In Ruby, the data structure closest to the list is called Array , so people coming to Groovy or Grails from Rails without a Java background tend to migrate the item, which leads to confusion.)
java.util.List is an interface that describes the basic operations on lists that are implemented by various types of lists. Lists use generic type parameters to describe what they can contain (types are optional in Groovy). Lists are not covariant due to type erasure. Shared collections rely on the compiler to provide type safety.
In Groovy, when you create a list using literal syntax ( def mylist = [] ), java.util.ArrayList is the implementation you get:
groovy:000> list = ['a', 'b', 'c'] ===> [] groovy:000> list instanceof List ===> true groovy:000> list.class ===> class java.util.ArrayList groovy:000> list.class.array ===> false groovy:000> list << 'd' ===> [d] groovy:000> list[0] ===> a
To create an array, you must add as (type)[] in the declaration:
groovy:000> stringarray = ['a', 'b', 'c'] as String[] ===> [a, b, c] groovy:000> stringarray.class ===> class [Ljava.lang.String; groovy:000> stringarray.class.array ===> true groovy:000> stringarray << 'd' ERROR groovy.lang.MissingMethodException: No signature of method: [Ljava.lang.String;.leftShift() is applicable for argument types: (java.lang.String) values: [d] groovy:000> stringarray[0] ===> a
There are already a few questions, ArrayList vs. LinkedList and when to use LinkedList <> on top of ArrayList <>? that cover the differences between LinkedList and ArrayList .