How can i achieve this in java. i have an object which has properties.
public class Object {
private final Credentials Credentials;
private final int PageSize;
private final int PageStart;
private final int DefaultFilterId;
public Object(Credentials Credentials, int PageSize, int PageStart,
int DefaultFilterId) {
this.Credentials = Credentials;
this.PageSize = PageSize;
this.PageStart = PageStart;
this.DefaultFilterId = DefaultFilterId;
}
}
Now i am forming a this object like this
Object obj = new Object(args);
At some point i need the same Object, with new properties added but removing some.
I do something like this in javascript.
var myCars=new Array();
myCars[0]="Saab";
myCars[1]="Volvo";
myCars[2]="BMW";
delete myCars[1]; or myCars.splice(1,1);
And you use that:
Also, you shouldn’t name your object “Object”, it’s the base class for all the classes in Java.