AvoidObjectArrays
Object arrays are inferior to collections in almost every way. Prefer immutable collections (e.g., ImmutableSet, ImmutableList, etc.) over an object array whenever possible.

Severity
WARNING

The problem

Object arrays are inferior to collections in almost every way. Prefer Set, List, or Multiset over an object array whenever possible.

A few of these issues are covered, in much greater detail, in Effective Java Item 28: Prefer lists to arrays.

Method Parameters

Don’t use object arrays as method parameters:

public void createUsers(User[] users) { ... }

Use an Iterable instead:

public void createUsers(Iterable<User> users) { ... }

Return Values

Don’t use object arrays as method return values:

public User[] loadUsers() { ... }

Use an ImmutableList (or ImmutableSet) instead:

public ImmutableList<User> loadUsers() { ... }

Additional Alternatives

If you have a 2-dimensional array (e.g., Foo[][]), consider using an ImmutableTable<Integer, Integer, Foo> instead.

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AvoidObjectArrays") to the enclosing element.