From: Matti Tahvonen Date: Thu, 14 Aug 2008 08:18:14 +0000 (+0000) Subject: Optimizing IndexedContainerProperty hashCode (or making it practical) X-Git-Tag: 6.7.0.beta1~4358 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=947c231a1893285771d0d20fdc9175d41875d906;p=vaadin-framework.git Optimizing IndexedContainerProperty hashCode (or making it practical) svn changeset:5183/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/data/util/IndexedContainer.java b/src/com/itmill/toolkit/data/util/IndexedContainer.java index ea8a01756a..648db7ff7e 100644 --- a/src/com/itmill/toolkit/data/util/IndexedContainer.java +++ b/src/com/itmill/toolkit/data/util/IndexedContainer.java @@ -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(); } /**