📄 abstractmap.html
字号:
<TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/AbstractMap.html#size()">size</A></B>()</CODE><BR> Returns the number of key-value mappings in this map.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/AbstractMap.html#toString()">toString</A></B>()</CODE><BR> Returns a string representation of this map.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/util/Collection.html">Collection</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/AbstractMap.html#values()">values</A></B>()</CODE><BR> Returns a collection view of the values contained in this map.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="AbstractMap()"><!-- --></A><H3>AbstractMap</H3><PRE>protected <B>AbstractMap</B>()</PRE><DL><DD>Sole constructor. (For invocation by subclass constructors, typically implicit.)</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>Returns the number of key-value mappings in this map. If the map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns <tt>Integer.MAX_VALUE</tt>.<p> This implementation returns <tt>entrySet().size()</tt>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#size()">size</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of key-value mappings in this map.</DL></DD></DL><HR><A NAME="isEmpty()"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>()</PRE><DL><DD>Returns <tt>true</tt> if this map contains no key-value mappings. <p> This implementation returns <tt>size() == 0</tt>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#isEmpty()">isEmpty</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD><tt>true</tt> if this map contains no key-value mappings.</DL></DD></DL><HR><A NAME="containsValue(java.lang.Object)"><!-- --></A><H3>containsValue</H3><PRE>public boolean <B>containsValue</B>(<A HREF="../../java/lang/Object.html">Object</A> value)</PRE><DL><DD>Returns <tt>true</tt> if this map maps one or more keys to this value. More formally, returns <tt>true</tt> if and only if this map contains at least one mapping to a value <tt>v</tt> such that <tt>(value==null ? v==null : value.equals(v))</tt>. This operation will probably require time linear in the map size for most implementations of map.<p> This implementation iterates over entrySet() searching for an entry with the specified value. If such an entry is found, <tt>true</tt> is returned. If the iteration terminates without finding such an entry, <tt>false</tt> is returned. Note that this implementation requires linear time in the size of the map.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#containsValue(java.lang.Object)">containsValue</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - value whose presence in this map is to be tested.<DT><B>Returns:</B><DD><tt>true</tt> if this map maps one or more keys to this value.</DL></DD></DL><HR><A NAME="containsKey(java.lang.Object)"><!-- --></A><H3>containsKey</H3><PRE>public boolean <B>containsKey</B>(<A HREF="../../java/lang/Object.html">Object</A> key)</PRE><DL><DD>Returns <tt>true</tt> if this map contains a mapping for the specified key. <p> This implementation iterates over <tt>entrySet()</tt> searching for an entry with the specified key. If such an entry is found, <tt>true</tt> is returned. If the iteration terminates without finding such an entry, <tt>false</tt> is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#containsKey(java.lang.Object)">containsKey</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key whose presence in this map is to be tested.<DT><B>Returns:</B><DD><tt>true</tt> if this map contains a mapping for the specified key.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the specified key is of an inappropriate type for this map.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - key is <tt>null</tt> and this map does not not permit <tt>null</tt> keys.</DL></DD></DL><HR><A NAME="get(java.lang.Object)"><!-- --></A><H3>get</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>get</B>(<A HREF="../../java/lang/Object.html">Object</A> key)</PRE><DL><DD>Returns the value to which this map maps the specified key. Returns <tt>null</tt> if the map contains no mapping for this key. A return value of <tt>null</tt> does not <i>necessarily</i> indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to <tt>null</tt>. The containsKey operation may be used to distinguish these two cases. <p> This implementation iterates over <tt>entrySet()</tt> searching for an entry with the specified key. If such an entry is found, the entry's value is returned. If the iteration terminates without finding such an entry, <tt>null</tt> is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#get(java.lang.Object)">get</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key whose associated value is to be returned.<DT><B>Returns:</B><DD>the value to which this map maps the specified key.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the specified key is of an inappropriate type for this map.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the key is <tt>null</tt> and this map does not not permit <tt>null</tt> keys.<DT><B>See Also: </B><DD><A HREF="../../java/util/AbstractMap.html#containsKey(java.lang.Object)"><CODE>containsKey(Object)</CODE></A></DL></DD></DL><HR><A NAME="put(java.lang.Object, java.lang.Object)"><!-- --></A><H3>put</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>put</B>(<A HREF="../../java/lang/Object.html">Object</A> key, <A HREF="../../java/lang/Object.html">Object</A> value)</PRE><DL><DD>Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for this key, the old value is replaced.<p> This implementation always throws an <tt>UnsupportedOperationException</tt>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#put(java.lang.Object, java.lang.Object)">put</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key with which the specified value is to be associated.<DD><CODE>value</CODE> - value to be associated with the specified key.<DT><B>Returns:</B><DD>previous value associated with specified key, or <tt>null</tt> if there was no mapping for key. (A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with the specified key, if the implementation supports <tt>null</tt> values.)<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>put</tt> operation is not supported by this map.<DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the class of the specified key or value prevents it from being stored in this map.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if some aspect of this key or value * prevents it from being stored in this map.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - this map does not permit <tt>null</tt> keys or values, and the specified key or value is <tt>null</tt>.</DL></DD></DL><HR><A NAME="remove(java.lang.Object)"><!-- --></A><H3>remove</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>remove</B>(<A HREF="../../java/lang/Object.html">Object</A> key)</PRE><DL><DD>Removes the mapping for this key from this map if present (optional operation). <p> This implementation iterates over <tt>entrySet()</tt> searching for an entry with the specified key. If such an entry is found, its value is obtained with its <tt>getValue</tt> operation, the entry is is removed from the Collection (and the backing map) with the iterator's <tt>remove</tt> operation, and the saved value is returned. If the iteration terminates without finding such an entry, <tt>null</tt> is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#remove(java.lang.Object)">remove</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key whose mapping is to be removed from the map.<DT><B>Returns:</B><DD>previous value associated with specified key, or <tt>null</tt> if there was no entry for key. (A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with the specified key, if the implementation supports <tt>null</tt> values.)<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>remove</tt> operation is not supported by this map.</DL></DD></DL><HR><A NAME="putAll(java.util.Map)"><!-- --></A><H3>putAll</H3><PRE>public void <B>putAll</B>(<A HREF="../../java/util/Map.html">Map</A> t)</PRE><DL><DD>Copies all of the mappings from the specified map to this map (optional operation). These mappings will replace any mappings that this map had for any of the keys currently in the specified map.<p> This implementation iterates over the specified map's <tt>entrySet()</tt> collection, and calls this map's <tt>put</tt> operation once for each entry returned by the iteration.<DD><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -