I have three classes in my project. One of them is class Main, which contain ArrayList of objects from class Operation. The last one class is Algorithm, which also contain ArrayList of objects from Operation. My problem is, when I remove object from one List it also removes from another. I don't know why, any hints? Here is the part of the code:
class Main{
static ArrayList<Operation> operations = new ArrayList<>();
...
public static void main(String args[]){
Algorithm algorithm = new Algorithm();
algorithm.mrowkowy();
}
class Algorithm{
ArrayList<Operation> operations_temp = Main.operations;
...
mrowkowy(){
...
Operation Actual = new Operation();
operations_temp.remove(Actual);
}