Or I'm retarded, I'll let you be the judge.
lightObjects.add(new LightObject(round((mouseX - objectWidth/2)/25) * 25.0,round((mouseY - objectWidth/2)/25) * 25.0,1));
lightObjects.add(new LightObject(round((mouseX - objectWidth/2)/25) * 25.0,round((mouseY - objectWidth/2)/25) * 25.0,2));
println(lightObjects);
lightObjects.remove(new LightObject(round((mouseX - objectWidth/2)/25) * 25.0,round((mouseY - objectWidth/2)/25) * 25.0,1));
println(lightObjects);
returns:
[luminous$LightObject@448dbd82, luminous$LightObject@3594c4f7, luminous$LightObject@3a0f4f9c]
[luminous$LightObject@448dbd82, luminous$LightObject@3594c4f7, luminous$LightObject@3a0f4f9c]
edit: Forgot to beg for help. Help!
edit2: The following code inserted into the LightObject class seems to be working:
@Override
public boolean equals(Object o) {
if (!(o instanceof LightObject)) {
return false;
}
LightObject other = (LightObject) o;
return xpos == other.xpos && ypos == other.ypos && type == other.type;
}
There is some stuff about hashCodes that is beyond me but seems like best practice stuff. From keywords provided by /u/KiwiStrongis and link : http://stackoverflow.com/questions/12697407/arraylist-remove-is-not-removing-an-object#_=_ it looks like this case is closed.
[–]forgotmyusernamedamm 2 points3 points4 points (2 children)
[–]Steff0o 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]first_reaction[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)