No, adding an object to the collection, you simply pass a link to this object (the address where the object is stored on the heap). Thus, adding one object several times to different collections is like distributing business cards, you do not duplicate yourself, but several people know where to find you;)
Here is the code:
LinkedList<MyObject> list1 = new LinkedList<MyObject>(); LinkedList<MyObject> list2 = new LinkedList<MyObject>(); MyObject obj = new MyObject(); list1.add(obj); list2.add(obj);
source share