I am creating an object:
public class Car {
private ArrayList<Door> doors;
private Engine engine;
public Car(ArrayList<Door> doors) {
this.doors = doors;
}
public Car setDoors(ArrayList<Door> doors) {
this.doors = doors;
return this;
}
public Car setEngine(Engine engine) {
this.engine = engine;
return this;
}// and getters
}
Although it has public setters, is it possible to create an instance of this class and then make it immutable after creation?