JBoss Cache SVN: r8197 - core/trunk/src/main/java/org/jboss/cache/util.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-20 12:21:27 -0400 (Thu, 20 Aug 2009)
New Revision: 8197
Modified:
core/trunk/src/main/java/org/jboss/cache/util/Immutables.java
Log:
Immutables fix
Modified: core/trunk/src/main/java/org/jboss/cache/util/Immutables.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/Immutables.java 2009-08-20 16:19:49 UTC (rev 8196)
+++ core/trunk/src/main/java/org/jboss/cache/util/Immutables.java 2009-08-20 16:21:27 UTC (rev 8197)
@@ -150,6 +150,7 @@
* @param map the map to copy from
* @return an immutable map copy
*/
+ @SuppressWarnings("unchecked")
public static <K, V> Map<K, V> immutableMapCopy(Map<? extends K, ? extends V> map)
{
Map<? extends K, ? extends V> copy = attemptKnownMapCopy(map);
@@ -170,6 +171,7 @@
* @param collection the collection to copy
* @return an immutable copy
*/
+ @SuppressWarnings("unchecked")
public static <T> Collection<T> immutableCollectionCopy(Collection<? extends T> collection)
{
Collection<? extends T> copy = attemptKnownSetCopy(collection);
@@ -188,10 +190,10 @@
{
if (map instanceof FastCopyHashMap)
return (T) ((FastCopyHashMap) map).clone();
+ if (map instanceof LinkedHashMap)
+ return (T) ((LinkedHashMap) map).clone();
if (map instanceof HashMap)
return (T) ((HashMap) map).clone();
- if (map instanceof LinkedHashMap)
- return (T) ((LinkedHashMap) map).clone();
if (map instanceof TreeMap)
return (T) ((TreeMap) map).clone();