I'm new to scala and i'm stuck with creating an object and adding it to an Object list in Scala. I want to do the below java implementation in scala. Please suggest a suitable approach.
class Foo {
private int x;
private int y;
public Foo(int x, int y){
this.x = x;
this.y = y;
}
public int getX(){
return x;
}
public void setX(int x){
this.x = x;
}
public int getY(){
return y;
}
public void setY(int y){
this.y = y;
}
}
class Main {
List<Foo> fooList = new ArrayList<>();
Foo foo = new Foo(1,2);
fooList.add(foo);
}