0

I have two ArrayList variables first ArrayList listOrders; the second is ArrayList selectedOrders = listOrders;

The problem is when i deleting listOrders it's clear selectedOrders value. Is there a way to store value after deleting his parent?

Walden
  • 57
  • 9
  • It seams you are using two `ArrayList` but their reference is same. Please share the code where you are creating both list, deleting an item – Ashish Tiwari Jun 24 '16 at 15:28

1 Answers1

1

If you want to hold 2 different references with the same data do:

ArrayList selectedOrders = new ArrayList<>(listOrders);
brandonscript
  • 68,675
  • 32
  • 163
  • 220
Juan Cruz Soler
  • 8,172
  • 5
  • 41
  • 44