I have got a POJO/Bean called Person
. It has a customized toString()
method.
I have also an array of Person
called presenters
:
Person[] presenters;
I want to join the presenters into one string with delimiter:
String presenters = String.join(", ", (CharSequence[]) presenters);
Note that to join into String
, I need to cast presetnters
into CharSequence[]
, but I got this exception:
cannot be cast presenters to [Ljava.lang.CharSequence;
Is there any quick fix for this?
@Federico Thanks for the refer, but array isn't exactly a list.... though I guess I can convert the array to list first.