I am trying to add null elements to an ArrayList. This is for the purpose of ignoring columns using supercsv: http://supercsv.sourceforge.net/examples_partial_reading.html I am processing multiple csv files which have different number of header columns.
csvBeanReader.getHeader(true) returns String[]. The line headers.add(null); is throwing an UnsupportedOperationException. Why? What did I do wrong?
List<String> headers = Arrays.asList(csvBeanReader.getHeader(true));
//add null columns to headers
for(int i=0; i<1000; i++){
headers.add(null);
}