I'm wondering about the best way to implement a matrix in Java in which columns and rows have to be easily added/removed.

Something like `double[][] matrix` seems quite heavy when it comes to column/row removal.

I did some searches but could not find a design pattern (or so) dealing with this. Do you have any suggestion? I'm not looking for a library but more some guidelines on what is needed. I was thinking of a mix of Lists and Maps but I'm not sure that's the most efficient.

This [link](https://stackoverflow.com/questions/2246819/dynamic-table-matrix-data-structure-for-java) provides a bit of help but I'm sure there is a design pattern for this, or at least a nice way to do it.

Here are some more specifications: I expect the matrix to be 300x300 big in general. I need to do many manipulations though (I'm doing a heuristic that updates it a lot, hundreds times/sec), thus I can't browse it every time I want to update it. There's no maximum size but I don't expect it to be larger that 5000x5000.