Java: StringUtils.join on an ArrayList returns NoSuchMethodError Exception -
I have an ArrayList that I would like to connect with a delimiter of ',' I have read here in some answers that StringUtils. Joint is a good choice but the problem is that when I try to join an ArrayList, I get the following error:
java.lang.NoSuchMethodError: org.apache. Commons.lang.StringUtils. Ljava / Lang / string; (C Ljava / util / archive);
Code:
Array list & lt; String & gt; Friends list = new Array's & lt; String & gt; (); . . . StringUtils.join (Friends list, ',');
What am I missing?
When I am coding with Netbeen, I do not warn this error, this is when I try to compile.
You have an older version of Commons-Lang, get the latest version, which has this method.
Alternatively, you can call StringUtils.join (friendsList.toArray (), ',')
Comments
Post a Comment