Inspectopedia
 
2024.3

Suspicious 'Collection.toArray()' call

Warning
New
Last modified: 03 December 2024

Reports suspicious calls to Collection.toArray().

The following types of calls are considered suspicious:

  • when the type of the array argument is not the same as the array type to which the result is casted.

  • when the type of the array argument does not match the type parameter in the collection declaration.

Example: