You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/10/11 07:31:18 UTC
svn commit: r583712 - /incubator/xap/trunk/codebase/src/xap/util/Hashtable.js
Author: jmargaris
Date: Thu Oct 11 00:31:17 2007
New Revision: 583712
URL: http://svn.apache.org/viewvc?rev=583712&view=rev
Log:
key generation optimization
Modified:
incubator/xap/trunk/codebase/src/xap/util/Hashtable.js
Modified: incubator/xap/trunk/codebase/src/xap/util/Hashtable.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/util/Hashtable.js?rev=583712&r1=583711&r2=583712&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/util/Hashtable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/util/Hashtable.js Thu Oct 11 00:31:17 2007
@@ -51,7 +51,7 @@
* A key we keep incrementing to help us assign
* new unique has keys to objects.
*/
-xap.util.Hashtable.s_uniqueKey = 0;
+xap.util.Hashtable.s_uniqueKey = 1;
/**
* Clears the hashtable of all key/value pairs.
@@ -107,19 +107,12 @@
* @return The old value that was mapped to the given key.
*/
xap.util.Hashtable.prototype.put = function( key, value ) {
- if ( key == null ) {
- throw new xap.util.Exception( "key cannot be null at xap.util.Hashtable.put()" );
- }
- if( value == null ) {
- throw new xap.util.Exception( "value cannot be null at xap.util.Hashtable.put()" );
- }
key = this._computeKey(key);
- if( this._hashtable[key] == null ) {
+ var o = this._hashtable[key];
+ this._hashtable[key] = value;
+ if( o == null ) {
this._size++;
}
-
- var o = this._hashtable[key];
- this._hashtable[key] = value;
return o;
}
@@ -220,7 +213,7 @@
return x.toString();
}
- if (x._xapHashKey==null){
+ if (!x._xapHashKey){
x._xapHashKey = xap.util.Hashtable.s_uniqueKey++;
}
return x._xapHashKey.toString();