/** * Transfer all entries from current table to newTable. */ private void transfer(Entry<V>[] newTable) { Entry<V>[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.hash, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } }
private Entry<V> getEntry(String nsUri,String localName) { // strings must be interned assert nsUri==nsUri.intern(); assert localName==localName.intern(); int hash = hash(localName); int i = indexFor(hash, table.length); Entry<V> e = table[i]; while (e != null && !(localName == e.localName && nsUri == e.nsUri)) e = e.next; return e; }
/** * Associates the specified value with the specified keys in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param namespaceUri First key with which the specified value is to be associated. * @param localname Second key with which the specified value is to be associated. * @param value value to be associated with the specified key. * */ public void put(String namespaceUri,String localname, V value ) { //keys cannot be null assert localname !=null; assert namespaceUri !=null; // keys must be interned assert localname == localname.intern(); assert namespaceUri == namespaceUri.intern(); int hash = hash(localname); int i = indexFor(hash, table.length); for (Entry<V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && localname == e.localName && namespaceUri==e.nsUri) { e.value = value; return; } } addEntry(hash, namespaceUri,localname, value, i); }
/** * Transfer all entries from current table to newTable. */ private void transfer(Entry<V>[] newTable) { Entry<V>[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.hash, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } }
private Entry<V> getEntry(String nsUri,String localName) { // strings must be interned assert nsUri==nsUri.intern(); assert localName==localName.intern(); int hash = hash(localName); int i = indexFor(hash, table.length); Entry<V> e = table[i]; while (e != null && !(localName == e.localName && nsUri == e.nsUri)) e = e.next; return e; }
/** * Associates the specified value with the specified keys in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param namespaceUri First key with which the specified value is to be associated. * @param localname Second key with which the specified value is to be associated. * @param value value to be associated with the specified key. * */ public void put(String namespaceUri,String localname, V value ) { //keys cannot be null assert localname !=null; assert namespaceUri !=null; // keys must be interned assert localname == localname.intern(); assert namespaceUri == namespaceUri.intern(); int hash = hash(localname); int i = indexFor(hash, table.length); for (Entry<V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && localname == e.localName && namespaceUri==e.nsUri) { e.value = value; return; } } addEntry(hash, namespaceUri,localname, value, i); }
/** * Transfer all entries from current table to newTable. */ private void transfer(Entry<V>[] newTable) { Entry<V>[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.hash, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } }
/** * Transfer all entries from current table to newTable. */ private void transfer(Entry<V>[] newTable) { Entry<V>[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.hash, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } }
private Entry<V> getEntry(String nsUri,String localName) { // strings must be interned assert nsUri==nsUri.intern(); assert localName==localName.intern(); int hash = hash(localName); int i = indexFor(hash, table.length); Entry<V> e = table[i]; while (e != null && !(localName == e.localName && nsUri == e.nsUri)) e = e.next; return e; }
private Entry<V> getEntry(String nsUri,String localName) { // strings must be interned assert nsUri==nsUri.intern(); assert localName==localName.intern(); int hash = hash(localName); int i = indexFor(hash, table.length); Entry<V> e = table[i]; while (e != null && !(localName == e.localName && nsUri == e.nsUri)) e = e.next; return e; }
/** * Associates the specified value with the specified keys in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param namespaceUri First key with which the specified value is to be associated. * @param localname Second key with which the specified value is to be associated. * @param value value to be associated with the specified key. * */ public void put(String namespaceUri,String localname, V value ) { //keys cannot be null assert localname !=null; assert namespaceUri !=null; // keys must be interned assert localname == localname.intern(); assert namespaceUri == namespaceUri.intern(); int hash = hash(localname); int i = indexFor(hash, table.length); for (Entry<V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && localname == e.localName && namespaceUri==e.nsUri) { e.value = value; return; } } addEntry(hash, namespaceUri,localname, value, i); }
/** * Associates the specified value with the specified keys in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param namespaceUri First key with which the specified value is to be associated. * @param localname Second key with which the specified value is to be associated. * @param value value to be associated with the specified key. * */ public void put(String namespaceUri,String localname, V value ) { //keys cannot be null assert localname !=null; assert namespaceUri !=null; // keys must be interned assert localname == localname.intern(); assert namespaceUri == namespaceUri.intern(); int hash = hash(localname); int i = indexFor(hash, table.length); for (Entry<V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && localname == e.localName && namespaceUri==e.nsUri) { e.value = value; return; } } addEntry(hash, namespaceUri,localname, value, i); }