⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simplehashtable.html

📁 发布/订阅系统路由重配算法,可应用于ad hoc环境
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="SimpleHashtable()"><!-- --></A><H3>SimpleHashtable</H3><PRE>public <B>SimpleHashtable</B>()</PRE><DL><DD>Constructs a new <code>SimpleHashtable</code> object with the following default parameters: <code>minCapacity = 10</code>, <code>maxCapacity = Integer.MAX_VALUE</code>, <code>minLoadFactor = 0.0f</code>, <code>maxLoadFactor = 0.75f</code> and <code>capacityRate = 2.0f</code>.<P></DL><HR><A NAME="SimpleHashtable(int, float)"><!-- --></A><H3>SimpleHashtable</H3><PRE>public <B>SimpleHashtable</B>(int&nbsp;minCapacity,                       float&nbsp;maxLoadFactor)</PRE><DL><DD>Constructs a new <code>SimpleHashtable</code> object with the specified and following default parameters: <code>maxCapacity = Integer.MAX_VALUE</code>, <code>minLoadFactor = 0.0f</code> and <code>capacityRate = 2.0f</code>.<P><DT><B>Parameters:</B><DD><CODE>minCapacity</CODE> - the minimum capacity of the internal bucket array.<DD><CODE>maxLoadFactor</CODE> - the maximum tolarated load factor.<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>minCapacity</code> is         less than <code>1</code> or if <code>maxLoadFactor</code>         is equal or less than <code>0.0f</code>.</DL><HR><A NAME="SimpleHashtable(int, int, float, float, float)"><!-- --></A><H3>SimpleHashtable</H3><PRE>public <B>SimpleHashtable</B>(int&nbsp;minCapacity,                       int&nbsp;maxCapacity,                       float&nbsp;minLoadFactor,                       float&nbsp;maxLoadFactor,                       float&nbsp;capacityRate)</PRE><DL><DD>Constructs a new empty <code>SimpleHashtable</code> object with the specified parameters. <p>  <code>minCapacity</code> and <code>maxCapacity</code> limit the size of the used internal bucket array. Note that a too high <code>minCapacity</code> wastes space, while a too low <code>maxCapacity</code> leads to hash collisions and decreases the performance. <p>  <code>minLoadFactor</code> and <code>maxLoadFactor</code> control when the internal bucket array's capacity is adapted and the table  is rehashed. When the total number of stored entries in the hashtable drops below the product of the <code>minLoadFactor</code> and the current capacity, the capacity is reduced by <code>capacityRate</code>. When the total number of stored entries in the hashtable exceeds the product of the <code>maxLoadFactor</code> and the current capacity, the capacity is extended by <code>capacityRate</code>. Note that the capacity will never fall short of  <code>minCapacity</code> or exceed <code>maxCapacity</code>. <p>  Note also that the constructor will check all parameters whether they are valid. It is not checked if their combination makes sense.<P><DT><B>Parameters:</B><DD><CODE>minCapacity</CODE> - the minimum capacity of the internal bucket array.<DD><CODE>maxCapacity</CODE> - the maximum capacity of the internal bucker array.<DD><CODE>minLoadFactor</CODE> - the minimum tolerated load factor.<DD><CODE>maxLoadFactor</CODE> - the maximum tolarated load factor.<DD><CODE>capacityRate</CODE> - the capacity adaption rate.<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>minCapacity</code> or         <code>maxCapacity</code> are less than <code>1</code>,         if <code>minLoadFactor</code> is less than <code>0.0f</code>,         if <code>maxLoadFactor</code> is equal or less than         <code>0.0f</code> or if <code>capacityRate</code> is          equal or less than <code>1.0f</code>.</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="rehash(int)"><!-- --></A><H3>rehash</H3><PRE>protected void <B>rehash</B>(int&nbsp;capacity)</PRE><DL><DD>Reorganizes the hashtable to use a new internal bucket array of the specified capacity.  This method is called automatically if the number of stored entries drops below the product of minimum load factor and the current capacity or if the number of stored entries exceeds the product of the maximum load factor and the current capacity.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>capacity</CODE> - the new capacity of the internal bucket array.</DL></DD></DL><HR><A NAME="put(java.lang.Object, java.lang.Object)"><!-- --></A><H3>put</H3><PRE>public java.lang.Object <B>put</B>(java.lang.Object&nbsp;key,                            java.lang.Object&nbsp;value)</PRE><DL><DD>Maps the specified <code>key</code> to the specified  <code>value</code> in this hashtable. Both the key and the  value can be <code>null</code>. <p> The value can be retrieved by calling the <code>get</code> method  with a key that is equal to the original key. <p>  The table is rehashed, when the <code>put</code> operation causes the number of entries to exceed the product of the maximum load factor and the current capacity.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the hashtable key.<DD><CODE>value</CODE> - the value.<DT><B>Returns:</B><DD>the previous value of the specified key in this hashtable,         or <code>null</code> if it did not have one.<DT><B>See Also:</B><DD><A HREF="../util/SimpleHashtable.html#get(java.lang.Object)"><CODE>get(Object)</CODE></A></DL></DD></DL><HR><A NAME="remove(java.lang.Object)"><!-- --></A><H3>remove</H3><PRE>public java.lang.Object <B>remove</B>(java.lang.Object&nbsp;key)</PRE><DL><DD>Removes the key (and its corresponding value) from this hashtable.  This method does nothing if the key is not in the hashtable. <p>  The table is rehashed, when the <code>remove</code> operation causes the number of entries to drops below the product of the minimum load  factor and the current capacity.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the key that needs to be removed.<DT><B>Returns:</B><DD>the value to which the key had been mapped in this hashtable,          or <code>null</code> if the key did not have a mapping.</DL></DD></DL><HR><A NAME="get(java.lang.Object)"><!-- --></A><H3>get</H3><PRE>public java.lang.Object <B>get</B>(java.lang.Object&nbsp;key)</PRE><DL><DD>Returns the value to which the specified key is mapped in this hashtable.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - a key in the hashtable.<DT><B>Returns:</B><DD>the value to which the key is mapped in this hashtable or         <code>null</code> if the key is not mapped to any value in         this hashtable.<DT><B>See Also:</B><DD><A HREF="../util/SimpleHashtable.html#put(java.lang.Object, java.lang.Object)"><CODE>put(Object, Object)</CODE></A></DL></DD></DL><HR><A NAME="containsKey(java.lang.Object)"><!-- --></A><H3>containsKey</H3><PRE>public boolean <B>containsKey</B>(java.lang.Object&nbsp;key)</PRE><DL><DD>Tests if the specified object is a key in this hashtable.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the object to test.<DT><B>Returns:</B><DD><code>true</code> if and only if the specified object           is a key in this hashtable, as determined by the           <tt>equals</tt> method; <code>false</code> otherwise.<DT><B>See Also:</B><DD><A HREF="../util/SimpleHashtable.html#contains(java.lang.Object)"><CODE>contains(Object)</CODE></A></DL></DD></DL><HR><A NAME="contains(java.lang.Object)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(java.lang.Object&nbsp;value)</PRE><DL><DD>Tests if the specified value is stored in this hashtable. This operation is more expensive than the <code>containsKey</code> method, since it sequentially searches the table. <p> Note that this method is identical in functionality to  <code>containsValue</code>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to search for.<DT><B>Returns:</B><DD><code>true</code> if and only if some key maps to the         <code>value</code> argument in this hashtable as          determined by the <tt>equals</tt> method;         <code>false</code> otherwise.<DT><B>See Also:</B><DD><A HREF="../util/SimpleHashtable.html#containsKey(java.lang.Object)"><CODE>containsKey(Object)</CODE></A>, <A HREF="../util/SimpleHashtable.html#containsValue(java.lang.Object)"><CODE>containsValue(Object)</CODE></A></DL></DD></DL><HR><A NAME="containsValue(java.lang.Object)"><!-- --></A><H3>containsValue</H3><PRE>public boolean <B>containsValue</B>(java.lang.Object&nbsp;value)</PRE><DL><DD>Tests if the specified value is stored in this hashtable. This operation is more expensive than the <code>containsKey</code> method, since it sequentially searches the table. <p> Note that this method is identical in functionality to  <code>contains</code>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to search for.<DT><B>Returns:</B><DD><code>true</code> if and only if some key maps to the         <code>value</code> argument in this hashtable as          determined by the <tt>equals</tt> method;         <code>false</code> otherwise.<DT><B>See Also:</B><DD><A HREF="../util/SimpleHashtable.html#containsKey(java.lang.Object)"><CODE>containsKey(Object)</CODE></A>, <A HREF="../util/SimpleHashtable.html#contains(java.lang.Object)"><CODE>contains(Object)</CODE></A></DL></DD></DL><HR><A NAME="isEmpty()"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>()</PRE><DL><DD>Tests if this hashtable stores any entries.<P><DD><DL><DT><B>Returns:</B><DD><code>true<code> if this hashtable stores at least one entry;         otherwise <code>false</code>.</DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>Returns the number of entries stored in this hashtable.<P><DD><DL><DT><B>Returns:</B><DD>the number of entries stored in this hashtable.</DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>()</PRE><DL><DD>Clears this hashtable by replacing the internal bucket arry with an empty new one of minimum capacity.<P><DD><DL></DL></DD></DL><HR><A NAME="keyIterator()"><!-- --></A><H3>keyIterator</H3><PRE>public <A HREF="../util/ResetableIterator.html" title="interface in util">ResetableIterator</A> <B>keyIterator</B>()</PRE><DL><DD>Returns a new iterator of the hashtable keys, which is  <i>not</i> fail-fast.  Use the iterator methods on the returned object to fetch the keys sequentially. Note that no specific guarantee is made on the order of the elements returned.<P><DD><DL><DT><B>Returns:</B><DD>an iterator of the hashtable keys.</DL></DD></DL><HR><A NAME="valueIterator()"><!-- --></A><H3>valueIterator</H3><PRE>public <A HREF="../util/ResetableIterator.html" title="interface in util">ResetableIterator</A> <B>valueIterator</B>()</PRE><DL><DD>Returns a new iterator of the hashtable values, which is  <i>not</i> fail-fast.  Use the iterator methods on the returned object to fetch the values sequentially. Note that no specific guarantee is made on the order of the elements returned.<P><DD><DL><DT><B>Returns:</B><DD>an iterator of the hashtable values.</DL></DD></DL><HR><A NAME="entryIterator()"><!-- --></A><H3>entryIterator</H3><PRE>public <A HREF="../util/ResetableIterator.html" title="interface in util">ResetableIterator</A> <B>entryIterator</B>()</PRE><DL><DD><DL></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../util/ResetableIterator.html" title="interface in util"><B>PREV CLASS</B></A>&nbsp;&nbsp;NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="SimpleHashtable.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -