]> source.dussan.org Git - vaadin-framework.git/commitdiff
Optimizing IndexedContainerProperty hashCode (or making it practical)
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 14 Aug 2008 08:18:14 +0000 (08:18 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 14 Aug 2008 08:18:14 +0000 (08:18 +0000)
svn changeset:5183/svn branch:trunk

src/com/itmill/toolkit/data/util/IndexedContainer.java

index ea8a01756a03555232beb92ccc35e654217fdfff..648db7ff7e208faf38a3d9d5363e44b8ada74b87 100644 (file)
@@ -141,8 +141,10 @@ public class IndexedContainer implements Container, Container.Indexed,
      */
     public Item getItem(Object itemId) {
 
-       // Null ids are not accepted
-       if (itemId == null) throw new NullPointerException("Container item id can not be null");
+        // Null ids are not accepted
+        if (itemId == null) {
+            throw new NullPointerException("Container item id can not be null");
+        }
 
         if (items.containsKey(itemId)
                 && (filteredItemIds == null || filteredItemIds.contains(itemId))) {
@@ -339,9 +341,11 @@ public class IndexedContainer implements Container, Container.Indexed,
      */
     public Item addItem(Object itemId) {
 
-       // Null ids are not accepted
-       if (itemId == null) throw new NullPointerException("Container item id can not be null");
-       
+        // Null ids are not accepted
+        if (itemId == null) {
+            throw new NullPointerException("Container item id can not be null");
+        }
+
         // Makes sure that the Item has not been created yet
         if (items.containsKey(itemId)) {
             return null;
@@ -1195,8 +1199,9 @@ public class IndexedContainer implements Container, Container.Indexed,
          */
         private IndexedContainerProperty(Object itemId, Object propertyId) {
             if (itemId == null || propertyId == null) {
-               // Null ids are not accepted
-               throw new NullPointerException("Container item or property ids can not be null");
+                // Null ids are not accepted
+                throw new NullPointerException(
+                        "Container item or property ids can not be null");
             }
             this.propertyId = propertyId;
             this.itemId = itemId;
@@ -1330,8 +1335,7 @@ public class IndexedContainer implements Container, Container.Indexed,
          * @return A locally unique hash-code as integer
          */
         public int hashCode() {
-            return itemId.hashCode() ^ propertyId.hashCode()
-                    ^ IndexedContainer.this.hashCode();
+            return itemId.hashCode() ^ propertyId.hashCode();
         }
 
         /**