How to represent a 2D matrix in Java?

后端 未结 3 376
余生分开走
余生分开走 2020-12-31 17:11

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

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 17:45

    If you need thread safe behavior, use

    Vector> matrix = new Vector>();
    

    If you don't need thread safe behavior, use

    ArrayList> matrix = new ArrayList>();
    

提交回复
热议问题