111 int hash = hash(localname); 112 int i = indexFor(hash, table.length); 113 114 for (Entry<V> e = table[i]; e != null; e = e.next) { 115 if (e.hash == hash && localname.equals(e.localName) && namespaceUri.equals(e.nsUri)) { 116 e.value = value; 117 return; 118 } 119 } 120 121 addEntry(hash, namespaceUri,localname, value, i); 122 123 } 124 125 public void put(QName name, V value ) { 126 put(name.getNamespaceURI(),name.getLocalPart(),value); 127 } 128 129 /** 130 * Returns the value to which the specified keys are mapped in this QNameMap, 131 * or <tt>null</tt> if the map contains no mapping for this key. 132 * 133 * @param nsUri the namespaceUri key whose associated value is to be returned. 134 * @param localPart the localPart key whose associated value is to be returned. 135 * @return the value to which this map maps the specified set of keya, or 136 * <tt>null</tt> if the map contains no mapping for this set of keys. 137 * @see #put(String,String, Object) 138 */ 139 public V get( @NotNull String nsUri, String localPart ) { 140 Entry<V> e = getEntry(nsUri,localPart); 141 if(e==null) return null; 142 else return e.value; 143 } 144 145 public V get( QName name ) { 146 return get(name.getNamespaceURI(),name.getLocalPart()); 147 } 148 149 /** 150 * Returns the number of keys-value mappings in this map. 151 * 152 * @return the number of keys-value mappings in this map. 153 */ 154 public int size() { 155 return size; 156 } | 111 int hash = hash(localname); 112 int i = indexFor(hash, table.length); 113 114 for (Entry<V> e = table[i]; e != null; e = e.next) { 115 if (e.hash == hash && localname.equals(e.localName) && namespaceUri.equals(e.nsUri)) { 116 e.value = value; 117 return; 118 } 119 } 120 121 addEntry(hash, namespaceUri,localname, value, i); 122 123 } 124 125 public void put(QName name, V value ) { 126 put(name.getNamespaceURI(),name.getLocalPart(),value); 127 } 128 129 /** 130 * Returns the value to which the specified keys are mapped in this QNameMap, 131 * or {@code null} if the map contains no mapping for this key. 132 * 133 * @param nsUri the namespaceUri key whose associated value is to be returned. 134 * @param localPart the localPart key whose associated value is to be returned. 135 * @return the value to which this map maps the specified set of keya, or 136 * {@code null} if the map contains no mapping for this set of keys. 137 * @see #put(String,String, Object) 138 */ 139 public V get( @NotNull String nsUri, String localPart ) { 140 Entry<V> e = getEntry(nsUri,localPart); 141 if(e==null) return null; 142 else return e.value; 143 } 144 145 public V get( QName name ) { 146 return get(name.getNamespaceURI(),name.getLocalPart()); 147 } 148 149 /** 150 * Returns the number of keys-value mappings in this map. 151 * 152 * @return the number of keys-value mappings in this map. 153 */ 154 public int size() { 155 return size; 156 } |