📄 map.html
字号:
<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>.<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.<DD><DL><DT><B>Returns:</B><DD><tt>true</tt> if this map contains no key-value mappings.</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.<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 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.</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 the specified 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 the <tt>Map</tt> interface.<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 the specified value.</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 <tt>containsKey</tt> operation may be used to distinguish these two cases.<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, or <tt>null</tt> if the map contains no mapping for this key.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the 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.<DT><B>See Also: </B><DD><A HREF="../../java/util/Map.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.<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).<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 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>remove</tt> method 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.<DD><DL><DT><B>Parameters:</B><DD><CODE>t</CODE> - Mappings to be stored in this map.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>putAll</tt> method is not supported by this map.<DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the class of a key or value in the specified map prevents it from being stored in this map.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - some aspect of a key or value in the specified map 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="clear()"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>()</PRE><DL><DD>Removes all mappings from this map (optional operation).<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - clear is not supported by this map.</DL></DD></DL><HR><A NAME="keySet()"><!-- --></A><H3>keySet</H3><PRE>public <A HREF="../../java/util/Set.html">Set</A> <B>keySet</B>()</PRE><DL><DD>Returns a set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt> <tt>retainAll</tt>, and <tt>clear</tt> operations. It does not support the add or <tt>addAll</tt> operations.<DD><DL><DT><B>Returns:</B><DD>a set view of the keys contained in this map.</DL></DD></DL><HR><A NAME="values()"><!-- --></A><H3>values</H3><PRE>public <A HREF="../../java/util/Collection.html">Collection</A> <B>values</B>()</PRE><DL><DD>Returns a collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress, the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations. It does not support the add or <tt>addAll</tt> operations.<DD><DL><DT><B>Returns:</B><DD>a collection view of the values contained in this map.</DL></DD></DL><HR><A NAME="entrySet()"><!-- --></A><H3>entrySet</H3><PRE>public <A HREF="../../java/util/Set.html">Set</A> <B>entrySet</B>()</PRE><DL><DD>Returns a set view of the mappings contained in this map. Each element in the returned set is a <tt>Map.Entry</tt>. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations. It does not support the <tt>add</tt> or <tt>addAll</tt> operations.<DD><DL><DT><B>Returns:</B><DD>a set view of the mappings contained in this map.</DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A> o)</PRE><DL><DD>Compares the specified object with this map for equality. Returns <tt>true</tt> if the given object is also a map and the two Maps represent the same mappings. More formally, two maps <tt>t1</tt> and <tt>t2</tt> represent the same mappings if <tt>t1.entrySet().equals(t2.entrySet())</tt>. This ensures that the <tt>equals</tt> method works properly across different implementations of the <tt>Map</tt> interface.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - object to be compared for equality with this map.<DT><B>Returns:</B><DD><tt>true</tt> if the specified object is equal to this map.</DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hashCodes of each entry in the map's entrySet view. This ensures that <tt>t1.equals(t2)</tt> implies that <tt>t1.hashCode()==t2.hashCode()</tt> for any two maps <tt>t1</tt> and <tt>t2</tt>, as required by the general contract of Object.hashCode.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the hash code value for this map.<DT><B>See Also: </B><DD><A HREF="../../java/util/Map.Entry.html#hashCode()"><CODE>Map.Entry.hashCode()</CODE></A>, <A HREF="../../java/lang/Object.html#hashCode()"><CODE>Object.hashCode()</CODE></A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(Object)</CODE></A>, <A HREF="../../java/util/Map.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Map.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/util/ListIterator.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/Map.Entry.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Map.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -