The rule S2201 checks whether the return value of a function that is free of side effects is assigned. However, the rule currently only checks certain immutable types and is thus severly limited. In addition to the these types calls to certain Collection methods should also be checked. For example:
Collection.contains(Object)
Collection.containsAll(Collection<?>)
Collection.size()
Collection.isEmpty()
Optionally, the following methods could be considered:
Collection.toArray()
Collection.toArray(T[])
Collection.iterator()