diff options
author | Sven Gothel <[email protected]> | 2010-11-05 07:54:12 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-05 07:54:12 +0100 |
commit | 6c1d55cda87cee557c364dc02322c8c11c02070e (patch) | |
tree | 0483eb2e72f2897c9d5c159a6d12170359ccb086 | |
parent | b3bf47a1166bcab09efb3ca1aac959d40ba8e029 (diff) |
Adding 'containsSafe' .. allowing verification of hash code
-rw-r--r-- | src/java/com/jogamp/common/util/ArrayHashSet.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/java/com/jogamp/common/util/ArrayHashSet.java b/src/java/com/jogamp/common/util/ArrayHashSet.java index 1d938f2..0840cde 100644 --- a/src/java/com/jogamp/common/util/ArrayHashSet.java +++ b/src/java/com/jogamp/common/util/ArrayHashSet.java @@ -162,7 +162,7 @@ public class ArrayHashSet * <br> * This is an O(1) operation. * - * @return true if the given element is contained by this list, + * @return true if the given element is contained by this list using fast hash map, * otherwise false. */ public final boolean contains(Object element) { @@ -174,7 +174,7 @@ public class ArrayHashSet * <br> * This is an O(n) operation, over the given Collection size. * - * @return true if the given Collection is completly contained by this list, + * @return true if the given Collection is completly contained by this list using hash map, * otherwise false. */ public final boolean containsAll(Collection c) { @@ -396,4 +396,20 @@ public class ArrayHashSet return identity; } + /** + * Test for containment + * <br> + * This is an O(n) operation, using equals operation over the list. + * <br> + * You may utilize this method to verify your hash values,<br> + * ie {@link #contains(java.lang.Object)} and {@link #containsSafe(java.lang.Object)} + * shall have the same result.<br> + * + * @return true if the given element is contained by this list using slow equals operation, + * otherwise false. + */ + public final boolean containsSafe(Object element) { + return data.contains(element); + } + } |