I have an arraylist of type "Person" entity and I wanted to get the separate instance of a object of type Person from arraylist. But when I do the same and update a property of a entity, the entity in the arraylist gets updated. Thus in all maintaining the same reference in memory to the object. I wanted to create a separate memory reference.In below code personEntity at postion 0 and 1 both get cardType "add".
Person personEntity=personArrayList.get(0);
personEntity.setCardType("add");
personArrayList.add(1,personEntity);