Is there a way to initialize multiple objects at once in a similiar way:
SimpleDoubleProperty sx, sy, vx, vy, dt, ro, w, angle, steps;
SimpleDoubleProperty[] prop = {sx,sy,vx,vy,dt,ro,w,angle,steps};
double[] initial = {0,0,10,10,0.1,1,1,60,20};
for(int i=0; i<prop.length; i++){
prop[i] = new SimpleDoubleProperty(initial[i]);
}
Main goal is to be able to use sx, sy.. variables on their own and shorten the code. I know that i'm overriding those variables (they are not stored in this array anymore) at this point:
prop[i] = new SimpleDoubleProperty(initial[i]);
but that was only an example to better present this problem.
double[] initial = {0,0,10,10,0.1,1,1,60,20};
sx = new SimpleDoubleProperty(initial[0]);
sy = new SimpleDoubleProperty(initial[1]);
vx = new SimpleDoubleProperty(initial[2]);
vy = new SimpleDoubleProperty(initial[3]);
dt = new SimpleDoubleProperty(initial[4]);
ro = new SimpleDoubleProperty(initial[5]);
w = new SimpleDoubleProperty(initial[6]);
angle = new SimpleDoubleProperty(initial[7]);
steps = new SimpleDoubleProperty(initial[8]);
Is there another way?