I have a 2D String Array in java where i is rows and j is cols.
I'm looking for an elegant solution to remove cols in the following array.
String[i][j] data;
The columns provided can either be a single column or more than one column i.e. if the columns to be removed are (7,8) then all values on data[i][7] and data [i][8] should be removed from the array.
I tried various solutions such as declaring a new array and copying from the previous array excluding the columns but I'm wondering if there's a more elegant solution I can use. Any leads?
ArrayListor some other more flexible type. (In fact, 90% of the time I'd just use one of those to begin with. Arrays are a pain.)ArrayListjust didn't exist, yeah, probably just make a new array and copy.