summaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-07 21:03:49 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-07 21:03:49 +0000
commit0d14ff0b2d9111cc9e621e6d09645ac59d2dd26d (patch)
treea09567998f1ce863b1accce49c0c96aa1838a251 /libjava/java
parent12b432e0af3cb10470db4e8b2160d0bc257e6d43 (diff)
downloadgcc-0d14ff0b2d9111cc9e621e6d09645ac59d2dd26d.tar.gz
* java/util/Hashtable.java (internalContainsValue): Removed.
(containsValue): Don't delegate to internalContainsValue. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74399 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/util/Hashtable.java57
1 files changed, 18 insertions, 39 deletions
diff --git a/libjava/java/util/Hashtable.java b/libjava/java/util/Hashtable.java
index d19b2fbbc81..9cfa925762a 100644
--- a/libjava/java/util/Hashtable.java
+++ b/libjava/java/util/Hashtable.java
@@ -333,11 +333,22 @@ public class Hashtable extends Dictionary
*/
public synchronized boolean contains(Object value)
{
- /* delegate to non-overridable worker method
- * to avoid blowing up the stack, when called
- * from overridden contains[Value]() method.
- */
- return internalContainsValue(value);
+ for (int i = buckets.length - 1; i >= 0; i--)
+ {
+ HashEntry e = buckets[i];
+ while (e != null)
+ {
+ if (value.equals(e.value))
+ return true;
+ e = e.next;
+ }
+ }
+
+ // Must throw on null argument even if the table is empty
+ if (value == null)
+ throw new NullPointerException();
+
+ return false;
}
/**
@@ -354,44 +365,12 @@ public class Hashtable extends Dictionary
*/
public boolean containsValue(Object value)
{
- /* delegate to older method to make sure code overwriting it
- * continues to work.
- */
+ // Delegate to older method to make sure code overriding it continues
+ // to work.
return contains(value);
}
/**
- * Returns true if this Hashtable contains a value <code>o</code>, such that
- * <code>o.equals(value)</code>. This is an internal worker method
- * called by <code>contains()</code> and <code>containsValue()</code>.
- *
- * @param value the value to search for in this Hashtable
- * @return true if at least one key maps to the value
- * @see #contains(Object)
- * @see #containsKey(Object)
- * @throws NullPointerException if <code>value</code> is null
- */
- private boolean internalContainsValue(Object value)
- {
- for (int i = buckets.length - 1; i >= 0; i--)
- {
- HashEntry e = buckets[i];
- while (e != null)
- {
- if (value.equals(e.value))
- return true;
- e = e.next;
- }
- }
-
- // Must throw on null argument even if the table is empty
- if (value == null)
- throw new NullPointerException();
-
- return false;
- }
-
- /**
* Returns true if the supplied object <code>equals()</code> a key
* in this Hashtable.
*