How to represent a 2D matrix in Java?
<p>I have to create in Java a 2D matrix (consisting of double values) as well as a 1D vector. It should be possible to access individual rows and columns as well as individual elements. Moreover, it should be thread-safe (threads writing at the same time). Perhaps later I need some matrix operations too.</p>

<p>Which data structure is best for this? Just a 2D array or a TreeMap? Or is there any amazing external library?</p>