Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

HashMap in HashMap not behaving as expected

$
0
0
Hey guys..

can anyone explain to me why this:

episodeID.clear();
	                    pst3 = con.prepareStatement("SELECT idEpisode, c00, c01, c03, c04, c05, c13 FROM episode WHERE idShow='" + rs.getInt(1) + "' AND c12='" + rs2.getInt(1) + "'");
	                    rs3 = pst3.executeQuery();
	                    while (rs3.next()) {
	                    	episodes.put("c00", rs3.getString(2));
	                    	episodes.put("c01", rs3.getString(3));
	                    	episodes.put("c03", rs3.getInt(4));
	                    	episodes.put("c04", rs3.getString(5));
	                    	episodes.put("c05", rs3.getString(6));
	                    	episodes.put("c13", rs3.getInt(7));
	                    	episodeID.put(rs3.getInt(1), episodes);
	                    }


produces a hashmap episodeID with a idEpisode as keys and the exact same hashmap (episodes) as value? why aren't the sub-hashmap (episodes) different from each other?

Mathias.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>