<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Copying ArrayList data, not references</title>
		<atom:link href="http://cycling74.com/forums/topic/copying-arraylist-data-not-references/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 14:57:25 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-30220</guid>
					<title><![CDATA[Copying ArrayList data, not references]]></title>
					<link>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-30220</link>
					<pubDate>Fri, 09 Feb 2007 19:39:34 +0000</pubDate>
					<dc:creator>jbm</dc:creator>

					<description>
						<![CDATA[
						<p>I hope that title makes some sort of sense&#8230;</p>
<p>I have to preface this by mentioning that I&#8217;m not even certain I&#8217;ve found the bug in my class, but I *think* I&#8217;ve found it.</p>
<p>I&#8217;ve got two Maps that will have different ways of using the contents of an single ArrayList<integer>. The ArrayList is all fine and happy as a value inside Map1. What I want to do is get the data from the ArrayList in Map1, move it over to Map2, and arrange it a little differently. I did a simple:</integer></p>
<p>newArrayList = Map1.get(keyToOldArrayList);<br />
Map2.put(newKey,newArrayList);</p>
<p>as a way of moving the data over. However, when I alter Map2, oldArrayList in Map1 gets altered as well. This is no big surprise, but how do I avoid it? I tried:</p>
<p>newArrayList.addAll(Map1.get(keyToOldArrayList);</p>
<p>but that has the same result (or so it seems).</p>
<p>BTW, if this is the way I&#8217;m supposed to copy the data, in order to make a copy I can manipulate without messing with Map1, then I&#8217;ve got another problem somewhere else and I&#8217;ll leave everybody alone. I just can&#8217;t see anywhere else that could be giving me this sort of trouble.</p>
<p>J.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-96108</guid>
					<title><![CDATA[Re: Copying ArrayList data, not references]]></title>
					<link>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-96108</link>
					<pubDate>Fri, 09 Feb 2007 19:56:28 +0000</pubDate>
					<dc:creator>maxmspjit</dc:creator>

					<description>
						<![CDATA[
						<p>On 07-02-09, at 1939, jbmaxwell wrote:<br />
><br />
> I hope that title makes some sort of sense&#8230;<br />
><br />
yep, you need to deep copy.</p>
<p><a href="http://java.sun.com/developer/JDCTechTips/2001/tt0410.html" rel="nofollow">http://java.sun.com/developer/JDCTechTips/2001/tt0410.html</a><br />
<a href="http://www.faqs.org/docs/think_java/TIJ319.htm" rel="nofollow">http://www.faqs.org/docs/think_java/TIJ319.htm</a></p>
<p><a href="http://www.google.com/search?q=java+arraylist+deep+copy" rel="nofollow">http://www.google.com/search?q=java+arraylist+deep+copy</a></p>
<p>hope that helps.</p>
<p>r.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-96109</guid>
					<title><![CDATA[Re: Copying ArrayList data, not references]]></title>
					<link>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-96109</link>
					<pubDate>Fri, 09 Feb 2007 20:09:05 +0000</pubDate>
					<dc:creator>jbm</dc:creator>

					<description>
						<![CDATA[
						<p>Cool, I&#8217;ll look into that. It&#8217;s amazing how far you can go and not ever have to do something so simple&#8230; weird.</p>
<p>thanks.</p>
<p>J.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-96110</guid>
					<title><![CDATA[Re: Copying ArrayList data, not references]]></title>
					<link>http://cycling74.com/forums/topic/copying-arraylist-data-not-references/#post-96110</link>
					<pubDate>Sat, 10 Feb 2007 10:21:54 +0000</pubDate>
					<dc:creator>jbm</dc:creator>

					<description>
						<![CDATA[
						<p>Brilliant. That was the problem. Fixed!</p>
<p>J.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

