I have the following code:
public void parseAttribs(String attribs){
//attribs is a comma separated list
//we are making a List from attribs by splitting the string at the commas
List<String> attributes = Arrays.asList(attribs.split("\\s*,\\s*"));
//when I try to add an element to the attributes List if fails
attributes.add("an element");
I've found this Unable to add a String to an ArrayList: "misplaced construct(s)" and tried to create a sub-class but I had to pass the List to the subclass as well and it still didn't work.
Could anyone please shed some light on this?
Many thanks