I have this code:
public static String SelectRandomFromTemplate(String template,int count) {
String[] split = template.split(\"|\");
List
This one has burned me many times. Arrays.asList
creates an unmodifiable list.
From the Javadoc: Returns a fixed-size list backed by the specified array.
Create a new list with the same content:
newList.addAll(Arrays.asList(newArray));
This will create a little extra garbage, but you will be able to mutate it.