【发布时间】:2021-08-05 05:15:16
【问题描述】:
我是 Java 新手,我需要存储大量点(x、y 浮点坐标)。哪个选项更适合存储在大数组中(使用更少的内存)?
点类:
// It`s in the same file as my main class
class Point {
public float x;
public float y;
public Point(float x, float y){
this.x = x;
this.y = y;
}
}
或数组数组:
float[] point = { 0.0f, 0.0f };
float[][] positions = { //Multiple Pointes here\\ };
【问题讨论】:
-
你认为有多少元素“大”?
标签: java arrays memory-management points