LPS-49544 add method  to convert List to Array directly

When there is need to extract properties from a list of objects, there
is a common idiom used in the portal:

    StringUtil.split(ListUtil.toString(list, accessor), x);

This pattern has, among others, the following problems:

  - It is only possible to get properties with a menaningful string
    representation.

  - The string representation of the properties must not contain the
  separator character.

  - Allocates unnecessary strings.

The new ListUtil.toArray method does the conversion without suffering
from any of this problems.
LPS-49544 add special case for primitive long

Primitive types and generics don't mix well.
LPS-49544 replace usages of new method where appropriate