📄 abstractmap.html
字号:
<DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#putAll(java.util.Map)">putAll</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><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> operation 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> - if 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). <p> This implementation calls <tt>entrySet().clear()</tt>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#clear()">clear</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><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 entry from the map, via the Iterator.remove, Set.remove, removeAll retainAll, and clear operations. It does not support the add or addAll operations.<p> This implementation returns a Set that subclasses AbstractSet. The subclass's iterator method returns a "wrapper object" over this map's entrySet() iterator. The size method delegates to this map's size method and the contains method delegates to this map's containsKey method.<p> The Set is created the first time this method is called, and returned in response to all subsequent calls. No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same Set.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#keySet()">keySet</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><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 entry 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 <tt>add</tt> or <tt>addAll</tt> operations.<p> This implementation returns a collection that subclasses abstract collection. The subclass's iterator method returns a "wrapper object" over this map's <tt>entrySet()</tt> iterator. The size method delegates to this map's size method and the contains method delegates to this map's containsValue method.<p> The collection is created the first time this method is called, and returned in response to all subsequent calls. No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same Collection.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#values()">values</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><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 abstract <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 this set is a Map.Entry. 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 entry 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>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#entrySet()">entrySet</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE></DL></DD><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.keySet().equals(t2.keySet())</tt> and for every key <tt>k</tt> in <tt>t1.keySet()</tt>, <tt> (t1.get(k)==null ? t2.get(k)==null : t1.get(k).equals(t2.get(k))) </tt>. This ensures that the <tt>equals</tt> method works properly across different implementations of the map interface.<p> This implementation first checks if the specified object is this map; if so it returns <tt>true</tt>. Then, it checks if the specified object is a map whose size is identical to the size of this set; if not, it it returns <tt>false</tt>. If so, it iterates over this map's <tt>entrySet</tt> collection, and checks that the specified map contains each mapping that this map contains. If the specified map fails to contain such a mapping, <tt>false</tt> is returned. If the iteration completes, <tt>true</tt> is returned.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#equals(java.lang.Object)">equals</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE><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 hash codes of each entry in the map's <tt>entrySet()</tt> 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.<p> This implementation iterates over <tt>entrySet()</tt>, calling <tt>hashCode</tt> on each element (entry) in the Collection, and adding up the results.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Map.html#hashCode()">hashCode</A></CODE> in interface <CODE><A HREF="../../java/util/Map.html">Map</A></CODE><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/Set.html#equals(java.lang.Object)"><CODE>Set.equals(Object)</CODE></A></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Returns a string representation of this map. The string representation consists of a list of key-value mappings in the order returned by the map's <tt>entrySet</tt> view's iterator, enclosed in braces (<tt>"{}"</tt>). Adjacent mappings are separated by the characters <tt>", "</tt> (comma and space). Each key-value mapping is rendered as the key followed by an equals sign (<tt>"="</tt>) followed by the associated value. Keys and values are converted to strings as by <tt>String.valueOf(Object)</tt>.<p> This implementation creates an empty string buffer, appends a left brace, and iterates over the map's <tt>entrySet</tt> view, appending the string representation of each <tt>map.entry</tt> in turn. After appending each entry except the last, the string <tt>", "</tt> is appended. Finally a right brace is appended. A string is obtained from the stringbuffer, and returned.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a String representation of this map.</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/AbstractMap.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/AbstractList.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/AbstractSequentialList.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="AbstractMap.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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 + -