ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci hi, my arraylistS in a covering arraylist behave like the same instance. i …=0; manupulate(myarrofarrs.get(i));[/CODE], and all the sub arraylists have become effected of the manupulation. i googled a little… Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by JamesCherrill … code it looks like you are iterating through all the ArrayLists applying the same maipulation to all of them, in which… have populated the arraylist badly, if false you have multiple arraylists containing the same data. Either way it will help diagnosing… Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci … were right, the population was wrong, just not in sub arraylists, member lists of the arraylist element objects. when i defining… been told to me to "deep copy" my arraylists now i see, i must "deep copy" the… Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by NormR1 Not sure what you are asking. Are you making copies of the objects the pointers in the ArrayList point to? Or are there only one set of objects with differents sets of pointers to them. The contents of the different arraylists all point to the same objects. Changing them via one arraylist references will change them for all arraylist references Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci i want all the objects in the different arraylists have different instances. for example [CODE]((ArrayList)encapsulatingArrayList.get(0)).… Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by JamesCherrill Here's a minimal block of code that shows different arraylists added to a master arraylist [CODE] ArrayList<ArrayList<… Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci …(temp); masterlist.set(i,temp); i++; }[/CODE] all the little arraylists has become populated with hello. Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by JamesCherrill … is static or you are executing code repeatedly across the arraylists. I realise you think both of those are not happening… Please help! Adding Integer ArrayLists Programming Software Development by dark_sider_1 … add (using the mathematical term) two Integer ArrayLists in Java, as well as divide them and …have large integers that are put into an ArrayLists, so to start off like 1233 and 1245…. How would I divide those two with ArrayLists? a.get(i)? I could easily do … like to add/divide the contents of the ArrayLists. If I used the get method and added… Copying ArrayLists Programming Software Development by 123a …....I need to copy many arraylists, if the user wants 5 arraylists I will have to create 5 arraylists and put all the… Re: Copying ArrayLists Programming Software Development by JamesCherrill If you need to create a variable number of ArrayLists then you will need some kind of container to put them in, eg an array or ArrayLists or an ArrayList of ArrayLists. Start with an new empty container, then in your loop create copies of the original ArrayList and add those copies to the container. Re: Copying ArrayLists Programming Software Development by apines As far as I know, and correct me if I'm wrong - the [URL="http://download.oracle.com/javase/6/docs/api/java/lang/System.html#arraycopy(java.lang.Object, int, java.lang.Object, int, int)"]System.arraycopy[/URL] copies arrays, not ArrayLists. Re: Copying ArrayLists Programming Software Development by JamesCherrill Yup, arraycopy copies arrays not ArrayLists. Collections.copy is the one. On the other hand, there is a constructor for ArrayList that does the same thing even more easily by taking any Collection as parameter and initialising the new ArrayList with all the data from that Collection, eg ArrayList myCopyList = new ArrayList(myOriginalList); Java Arraylists Programming Software Development by mbouster … types as name , id , address etc. To implement this using arraylists I must declare it as below? [CODE]Arraylist Customer =new… specific customer. How I am going to do this with arraylists also?? Re: Java Arraylists Programming Software Development by JamesCherrill … all my previous statements about pre- and post- 1.5 ArrayLists stand, but I'll withdraw the references to 1.6… using arraylists Programming Software Development by qwerty_ytrewq … to be sorted.I want the solution when we use arraylists for sorting.Could you help me? Re: using arraylists Programming Software Development by qwerty_ytrewq …;);//instead of such long code below,i want to use arraylists to do the below code for(int i=1;i… Re: using arraylists Programming Software Development by Ezzaral Those are arrays - not ArrayLists - and why are you not using an object to represent each line item instead of three separate arrays for each piece of data? Warning! Serialization + Java ArrayLists = Bad X_X Programming Software Development by Alex Edwards … data from one Client to another. Be aware of using ArrayLists during Serialization and consider creating your own Collection-implementation for… Help with a Database using Arraylists only Programming Software Development by TheStig01 … java language and no sql :/ He told me to use arraylists. Now i have been reading arraylist from the Java for… Re: Help with a Database using Arraylists only Programming Software Development by TheStig01 … i right in saying this?[/B] Then i create different arraylists per object. Where the index of each arraylist will correspond… Re: Help with a Database using Arraylists only Programming Software Development by Phaelax … and store it in another ArrayList. To manage all these ArrayLists, I'd use a HashMap and associate each array list… Subtracting values in arraylists Programming Software Development by Mark_48 … i am going to plot on a graph. For example ArrayLists A,B A - B C 0.564 - 0.356 = 0… Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by NormR1 Then create new instances for each ArrayList. If you copy references from one arraylist to another, that doesn't create new instances. Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci i think i create new instances by: [CODE]tempList=new ArrayList<MyObj>();[/CODE] do not i? Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci i only changed string to myobj because of the need of details: [CODE]while(i<masterlist.size()){ manipulate(masterList.get(i)); i++; }[/CODE] i have also tried [CODE] ArrayList<MyObj> temp; while(i<masterlist.size()){ temp=masterList.get(i); manipulate(temp); masterlist.set(i,temp); i++; }[/CODE] after ONLY one iteration of loops … Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by JamesCherrill Sorry, it's still not clear to me what you are saying. What happens if you don't execute that loop but just execute [CODE]temp=masterList.get(0); manipulate(temp); masterlist.set(0,temp);[/CODE] does that also affect all the subLists? Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by netci yes, exactly. Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by JamesCherrill OK Now please try masterlist.get(0)==masterlist.get(1) before and after that code block Re: ArrayLists behave like the same instance in ArrayList of ArrayListS Programming Software Development by JamesCherrill Do you have ANY static members (other than the main method)?