1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <!--NewPage--> 3 <HTML> 4 <HEAD> 5 <!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:48:00 PST 2010 --> 6 <TITLE> 7 Doubles (Guava Libraries 2010.01.04) 8 </TITLE> 9 10 <META NAME="date" CONTENT="2010-01-04"> 11 12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> 13 14 <SCRIPT type="text/javascript"> 15 function windowTitle() 16 { 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="Doubles (Guava Libraries 2010.01.04)"; 19 } 20 } 21 </SCRIPT> 22 <NOSCRIPT> 23 </NOSCRIPT> 24 25 </HEAD> 26 27 <BODY BGCOLOR="white" onload="windowTitle();"> 28 <HR> 29 30 31 <!-- ========= START OF TOP NAVBAR ======= --> 32 <A NAME="navbar_top"><!-- --></A> 33 <A HREF="#skip-navbar_top" title="Skip navigation links"></A> 34 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 35 <TR> 36 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 37 <A NAME="navbar_top_firstrow"><!-- --></A> 38 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 39 <TR ALIGN="center" VALIGN="top"> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Doubles.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49 </TABLE> 50 </TD> 51 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 52 </EM> 53 </TD> 54 </TR> 55 56 <TR> 57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="../../../../com/google/common/primitives/Chars.html" title="class in com.google.common.primitives"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/primitives/Floats.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD> 60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../../index.html?com/google/common/primitives/Doubles.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Doubles.html" target="_top"><B>NO FRAMES</B></A> 63 <SCRIPT type="text/javascript"> 64 <!-- 65 if(window==top) { 66 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 67 } 68 //--> 69 </SCRIPT> 70 <NOSCRIPT> 71 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 72 </NOSCRIPT> 73 74 75 </FONT></TD> 76 </TR> 77 <TR> 78 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 79 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 82 </TR> 83 </TABLE> 84 <A NAME="skip-navbar_top"></A> 85 <!-- ========= END OF TOP NAVBAR ========= --> 86 87 <HR> 88 <!-- ======== START OF CLASS DATA ======== --> 89 <H2> 90 <FONT SIZE="-1"> 91 com.google.common.primitives</FONT> 92 <BR> 93 Class Doubles</H2> 94 <PRE> 95 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> 96 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.primitives.Doubles</B> 97 </PRE> 98 <HR> 99 <DL> 100 <DT><PRE>public final class <B>Doubles</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> 101 </PRE> 102 103 <P> 104 Static utility methods pertaining to <code>double</code> primitives, that are not 105 already found in either <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang"><CODE>Double</CODE></A> or <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true" title="class or interface in java.util"><CODE>Arrays</CODE></A>. 106 <P> 107 108 <P> 109 <DL> 110 <DT><B>Since:</B></DT> 111 <DD>2009.09.15 <b>tentative</b></DD> 112 <DT><B>Author:</B></DT> 113 <DD>Kevin Bourrillion</DD> 114 </DL> 115 <HR> 116 117 <P> 118 119 <!-- ========== METHOD SUMMARY =========== --> 120 121 <A NAME="method_summary"><!-- --></A> 122 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 123 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 124 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 125 <B>Method Summary</B></FONT></TH> 126 </TR> 127 <TR BGCOLOR="white" CLASS="TableRowColor"> 128 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 129 <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</A>></CODE></FONT></TD> 130 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#asList(double...)">asList</A></B>(double... backingArray)</CODE> 131 132 <BR> 133 Returns a fixed-size list backed by the specified array, similar to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>.</TD> 134 </TR> 135 <TR BGCOLOR="white" CLASS="TableRowColor"> 136 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 137 <CODE>static int</CODE></FONT></TD> 138 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#compare(double, double)">compare</A></B>(double a, 139 double b)</CODE> 140 141 <BR> 142 Compares the two specified <code>double</code> values.</TD> 143 </TR> 144 <TR BGCOLOR="white" CLASS="TableRowColor"> 145 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 146 <CODE>static double[]</CODE></FONT></TD> 147 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#concat(double[]...)">concat</A></B>(double[]... arrays)</CODE> 148 149 <BR> 150 Returns the values from each provided array combined into a single array.</TD> 151 </TR> 152 <TR BGCOLOR="white" CLASS="TableRowColor"> 153 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 154 <CODE>static boolean</CODE></FONT></TD> 155 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#contains(double[], double)">contains</A></B>(double[] array, 156 double target)</CODE> 157 158 <BR> 159 Returns <code>true</code> if <code>target</code> is present as an element anywhere in 160 <code>array</code>.</TD> 161 </TR> 162 <TR BGCOLOR="white" CLASS="TableRowColor"> 163 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 164 <CODE>static double[]</CODE></FONT></TD> 165 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#ensureCapacity(double[], int, int)">ensureCapacity</A></B>(double[] array, 166 int minLength, 167 int padding)</CODE> 168 169 <BR> 170 Returns an array containing the same values as <code>array</code>, but 171 guaranteed to be of a specified minimum length.</TD> 172 </TR> 173 <TR BGCOLOR="white" CLASS="TableRowColor"> 174 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 175 <CODE>static int</CODE></FONT></TD> 176 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#hashCode(double)">hashCode</A></B>(double value)</CODE> 177 178 <BR> 179 Returns a hash code for <code>value</code>; equal to the result of invoking 180 <code>((Double) value).hashCode()</code>.</TD> 181 </TR> 182 <TR BGCOLOR="white" CLASS="TableRowColor"> 183 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 184 <CODE>static int</CODE></FONT></TD> 185 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#indexOf(double[], double)">indexOf</A></B>(double[] array, 186 double target)</CODE> 187 188 <BR> 189 Returns the index of the first appearance of the value <code>target</code> in 190 <code>array</code>.</TD> 191 </TR> 192 <TR BGCOLOR="white" CLASS="TableRowColor"> 193 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 194 <CODE>static int</CODE></FONT></TD> 195 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#indexOf(double[], double[])">indexOf</A></B>(double[] array, 196 double[] target)</CODE> 197 198 <BR> 199 Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.</TD> 200 </TR> 201 <TR BGCOLOR="white" CLASS="TableRowColor"> 202 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 203 <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 204 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#join(java.lang.String, double...)">join</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> separator, 205 double... array)</CODE> 206 207 <BR> 208 Returns a string containing the supplied <code>double</code> values, converted 209 to strings as specified by <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true#toString(double)" title="class or interface in java.lang"><CODE>Double.toString(double)</CODE></A>, and separated 210 by <code>separator</code>.</TD> 211 </TR> 212 <TR BGCOLOR="white" CLASS="TableRowColor"> 213 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 214 <CODE>static int</CODE></FONT></TD> 215 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#lastIndexOf(double[], double)">lastIndexOf</A></B>(double[] array, 216 double target)</CODE> 217 218 <BR> 219 Returns the index of the last appearance of the value <code>target</code> in 220 <code>array</code>.</TD> 221 </TR> 222 <TR BGCOLOR="white" CLASS="TableRowColor"> 223 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 224 <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><double[]></CODE></FONT></TD> 225 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#lexicographicalComparator()">lexicographicalComparator</A></B>()</CODE> 226 227 <BR> 228 Returns a comparator that compares two <code>double</code> arrays 229 lexicographically.</TD> 230 </TR> 231 <TR BGCOLOR="white" CLASS="TableRowColor"> 232 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 233 <CODE>static double</CODE></FONT></TD> 234 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#max(double...)">max</A></B>(double... array)</CODE> 235 236 <BR> 237 Returns the greatest value present in <code>array</code>, using the same rules 238 of comparison as <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Math.html?is-external=true#max(double, double)" title="class or interface in java.lang"><CODE>Math.max(double, double)</CODE></A>.</TD> 239 </TR> 240 <TR BGCOLOR="white" CLASS="TableRowColor"> 241 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 242 <CODE>static double</CODE></FONT></TD> 243 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#min(double...)">min</A></B>(double... array)</CODE> 244 245 <BR> 246 Returns the least value present in <code>array</code>, using the same rules of 247 comparison as <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Math.html?is-external=true#min(double, double)" title="class or interface in java.lang"><CODE>Math.min(double, double)</CODE></A>.</TD> 248 </TR> 249 <TR BGCOLOR="white" CLASS="TableRowColor"> 250 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 251 <CODE>static double[]</CODE></FONT></TD> 252 <TD><CODE><B><A HREF="../../../../com/google/common/primitives/Doubles.html#toArray(java.util.Collection)">toArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</A>> collection)</CODE> 253 254 <BR> 255 Copies a collection of <code>Double</code> instances into a new array of 256 primitive <code>double</code> values.</TD> 257 </TR> 258 </TABLE> 259 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 260 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 261 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 262 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> 263 </TR> 264 <TR BGCOLOR="white" CLASS="TableRowColor"> 265 <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 266 </TR> 267 </TABLE> 268 269 <P> 270 271 <!-- ============ METHOD DETAIL ========== --> 272 273 <A NAME="method_detail"><!-- --></A> 274 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 275 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 276 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 277 <B>Method Detail</B></FONT></TH> 278 </TR> 279 </TABLE> 280 281 <A NAME="hashCode(double)"><!-- --></A><H3> 282 hashCode</H3> 283 <PRE> 284 public static int <B>hashCode</B>(double value)</PRE> 285 <DL> 286 <DD>Returns a hash code for <code>value</code>; equal to the result of invoking 287 <code>((Double) value).hashCode()</code>. 288 <P> 289 <DD><DL> 290 <DT><B>Parameters:</B><DD><CODE>value</CODE> - a primitive <code>double</code> value 291 <DT><B>Returns:</B><DD>a hash code for the value</DL> 292 </DD> 293 </DL> 294 <HR> 295 296 <A NAME="compare(double, double)"><!-- --></A><H3> 297 compare</H3> 298 <PRE> 299 public static int <B>compare</B>(double a, 300 double b)</PRE> 301 <DL> 302 <DD>Compares the two specified <code>double</code> values. The sign of the value 303 returned is the same as that of <code>((Double) a).<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true#compareTo(java.lang.Double)" title="class or interface in java.lang">compareTo</A>(b)</code>. As with that method, <code>NaN</code> is 304 treated as greater than all other values, and <code>0.0 > -0.0</code>. 305 <P> 306 <DD><DL> 307 <DT><B>Parameters:</B><DD><CODE>a</CODE> - the first <code>double</code> to compare<DD><CODE>b</CODE> - the second <code>double</code> to compare 308 <DT><B>Returns:</B><DD>a negative value if <code>a</code> is less than <code>b</code>; a positive 309 value if <code>a</code> is greater than <code>b</code>; or zero if they are equal</DL> 310 </DD> 311 </DL> 312 <HR> 313 314 <A NAME="contains(double[], double)"><!-- --></A><H3> 315 contains</H3> 316 <PRE> 317 public static boolean <B>contains</B>(double[] array, 318 double target)</PRE> 319 <DL> 320 <DD>Returns <code>true</code> if <code>target</code> is present as an element anywhere in 321 <code>array</code>. Note that this always returns <code>false</code> when <code>target</code> is <code>NaN</code>. 322 <P> 323 <DD><DL> 324 <DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>double</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>double</code> value 325 <DT><B>Returns:</B><DD><code>true</code> if <code>array[i] == target</code> for some value of <code>i</code></DL> 326 </DD> 327 </DL> 328 <HR> 329 330 <A NAME="indexOf(double[], double)"><!-- --></A><H3> 331 indexOf</H3> 332 <PRE> 333 public static int <B>indexOf</B>(double[] array, 334 double target)</PRE> 335 <DL> 336 <DD>Returns the index of the first appearance of the value <code>target</code> in 337 <code>array</code>. Note that this always returns <code>-1</code> when <code>target</code> 338 is <code>NaN</code>. 339 <P> 340 <DD><DL> 341 <DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>double</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>double</code> value 342 <DT><B>Returns:</B><DD>the least index <code>i</code> for which <code>array[i] == target</code>, or 343 <code>-1</code> if no such index exists.</DL> 344 </DD> 345 </DL> 346 <HR> 347 348 <A NAME="indexOf(double[], double[])"><!-- --></A><H3> 349 indexOf</H3> 350 <PRE> 351 public static int <B>indexOf</B>(double[] array, 352 double[] target)</PRE> 353 <DL> 354 <DD>Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence. 355 356 <p>More formally, returns the lowest index <code>i</code> such that <code>java.util.Arrays.copyOfRange(array, i, i + target.length)</code> contains exactly 357 the same elements as <code>target</code>. 358 359 <p>Note that this always returns <code>-1</code> when <code>target</code> contains 360 <code>NaN</code>. 361 <P> 362 <DD><DL> 363 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to search for the sequence <code>target</code><DD><CODE>target</CODE> - the array to search for as a sub-sequence of <code>array</code></DL> 364 </DD> 365 </DL> 366 <HR> 367 368 <A NAME="lastIndexOf(double[], double)"><!-- --></A><H3> 369 lastIndexOf</H3> 370 <PRE> 371 public static int <B>lastIndexOf</B>(double[] array, 372 double target)</PRE> 373 <DL> 374 <DD>Returns the index of the last appearance of the value <code>target</code> in 375 <code>array</code>. Note that this always returns <code>-1</code> when <code>target</code> 376 is <code>NaN</code>. 377 <P> 378 <DD><DL> 379 <DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>double</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>double</code> value 380 <DT><B>Returns:</B><DD>the greatest index <code>i</code> for which <code>array[i] == target</code>, 381 or <code>-1</code> if no such index exists.</DL> 382 </DD> 383 </DL> 384 <HR> 385 386 <A NAME="min(double...)"><!-- --></A><H3> 387 min</H3> 388 <PRE> 389 public static double <B>min</B>(double... array)</PRE> 390 <DL> 391 <DD>Returns the least value present in <code>array</code>, using the same rules of 392 comparison as <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Math.html?is-external=true#min(double, double)" title="class or interface in java.lang"><CODE>Math.min(double, double)</CODE></A>. 393 <P> 394 <DD><DL> 395 <DT><B>Parameters:</B><DD><CODE>array</CODE> - a <i>nonempty</i> array of <code>double</code> values 396 <DT><B>Returns:</B><DD>the value present in <code>array</code> that is less than or equal to 397 every other value in the array 398 <DT><B>Throws:</B> 399 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>array</code> is empty</DL> 400 </DD> 401 </DL> 402 <HR> 403 404 <A NAME="max(double...)"><!-- --></A><H3> 405 max</H3> 406 <PRE> 407 public static double <B>max</B>(double... array)</PRE> 408 <DL> 409 <DD>Returns the greatest value present in <code>array</code>, using the same rules 410 of comparison as <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Math.html?is-external=true#max(double, double)" title="class or interface in java.lang"><CODE>Math.max(double, double)</CODE></A>. 411 <P> 412 <DD><DL> 413 <DT><B>Parameters:</B><DD><CODE>array</CODE> - a <i>nonempty</i> array of <code>double</code> values 414 <DT><B>Returns:</B><DD>the value present in <code>array</code> that is greater than or equal to 415 every other value in the array 416 <DT><B>Throws:</B> 417 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>array</code> is empty</DL> 418 </DD> 419 </DL> 420 <HR> 421 422 <A NAME="concat(double[]...)"><!-- --></A><H3> 423 concat</H3> 424 <PRE> 425 public static double[] <B>concat</B>(double[]... arrays)</PRE> 426 <DL> 427 <DD>Returns the values from each provided array combined into a single array. 428 For example, <code>concat(new double[] {a, b}, new double[] {}, new 429 double[] {c}</code> returns the array <code>{a, b, c}</code>. 430 <P> 431 <DD><DL> 432 <DT><B>Parameters:</B><DD><CODE>arrays</CODE> - zero or more <code>double</code> arrays 433 <DT><B>Returns:</B><DD>a single array containing all the values from the source arrays, in 434 order</DL> 435 </DD> 436 </DL> 437 <HR> 438 439 <A NAME="ensureCapacity(double[], int, int)"><!-- --></A><H3> 440 ensureCapacity</H3> 441 <PRE> 442 public static double[] <B>ensureCapacity</B>(double[] array, 443 int minLength, 444 int padding)</PRE> 445 <DL> 446 <DD>Returns an array containing the same values as <code>array</code>, but 447 guaranteed to be of a specified minimum length. If <code>array</code> already 448 has a length of at least <code>minLength</code>, it is returned directly. 449 Otherwise, a new array of size <code>minLength + padding</code> is returned, 450 containing the values of <code>array</code>, and zeroes in the remaining places. 451 <P> 452 <DD><DL> 453 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the source array<DD><CODE>minLength</CODE> - the minimum length the returned array must guarantee<DD><CODE>padding</CODE> - an extra amount to "grow" the array by if growth is 454 necessary 455 <DT><B>Returns:</B><DD>an array containing the values of <code>array</code>, with guaranteed 456 minimum length <code>minLength</code> 457 <DT><B>Throws:</B> 458 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>minLength</code> or <code>padding</code> is 459 negative</DL> 460 </DD> 461 </DL> 462 <HR> 463 464 <A NAME="join(java.lang.String, double...)"><!-- --></A><H3> 465 join</H3> 466 <PRE> 467 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>join</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> separator, 468 double... array)</PRE> 469 <DL> 470 <DD>Returns a string containing the supplied <code>double</code> values, converted 471 to strings as specified by <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true#toString(double)" title="class or interface in java.lang"><CODE>Double.toString(double)</CODE></A>, and separated 472 by <code>separator</code>. For example, <code>join("-", 1.0, 2.0, 3.0)</code> returns 473 the string <code>"1.0-2.0-3.0"</code>. 474 <P> 475 <DD><DL> 476 <DT><B>Parameters:</B><DD><CODE>separator</CODE> - the text that should appear between consecutive values in 477 the resulting string (but not at the start or end)<DD><CODE>array</CODE> - an array of <code>double</code> values, possibly empty</DL> 478 </DD> 479 </DL> 480 <HR> 481 482 <A NAME="lexicographicalComparator()"><!-- --></A><H3> 483 lexicographicalComparator</H3> 484 <PRE> 485 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><double[]> <B>lexicographicalComparator</B>()</PRE> 486 <DL> 487 <DD>Returns a comparator that compares two <code>double</code> arrays 488 lexicographically. That is, it compares, using <A HREF="../../../../com/google/common/primitives/Doubles.html#compare(double, double)"><CODE>compare(double, double)</CODE></A>), the first pair of values that follow any 489 common prefix, or when one array is a prefix of the other, treats the 490 shorter array as the lesser. For example, 491 <code>[] < [1.0] < [1.0, 2.0] < [2.0]</code>. 492 493 <p>The returned comparator is inconsistent with <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><CODE>Object.equals(Object)</CODE></A> (since arrays support only identity equality), but 494 it is consistent with <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#equals(double[], double[])" title="class or interface in java.util"><CODE>Arrays.equals(double[], double[])</CODE></A>. 495 <P> 496 <DD><DL> 497 <DT><B>Since:</B></DT> 498 <DD>2010.01.04 <b>tentative</b></DD> 499 <DT><B>See Also:</B><DD><a href="http://en.wikipedia.org/wiki/Lexicographical_order"> 500 Lexicographical order</a> article at Wikipedia</DL> 501 </DD> 502 </DL> 503 <HR> 504 505 <A NAME="toArray(java.util.Collection)"><!-- --></A><H3> 506 toArray</H3> 507 <PRE> 508 public static double[] <B>toArray</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</A>> collection)</PRE> 509 <DL> 510 <DD>Copies a collection of <code>Double</code> instances into a new array of 511 primitive <code>double</code> values. 512 513 <p>Elements are copied from the argument collection as if by <code>collection.toArray()</code>. Calling this method is as thread-safe as calling 514 that method. 515 <P> 516 <DD><DL> 517 <DT><B>Parameters:</B><DD><CODE>collection</CODE> - a collection of <code>Double</code> objects 518 <DT><B>Returns:</B><DD>an array containing the same values as <code>collection</code>, in the 519 same order, converted to primitives 520 <DT><B>Throws:</B> 521 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>collection</code> or any of its elements 522 is null</DL> 523 </DD> 524 </DL> 525 <HR> 526 527 <A NAME="asList(double...)"><!-- --></A><H3> 528 asList</H3> 529 <PRE> 530 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</A>> <B>asList</B>(double... backingArray)</PRE> 531 <DL> 532 <DD>Returns a fixed-size list backed by the specified array, similar to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>. The list supports <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true#set(int, E)" title="class or interface in java.util"><CODE>List.set(int, Object)</CODE></A>, 533 but any attempt to set a value to <code>null</code> will result in a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang"><CODE>NullPointerException</CODE></A>. 534 535 <p>The returned list maintains the values, but not the identities, of 536 <code>Double</code> objects written to or read from it. For example, whether 537 <code>list.get(0) == list.get(0)</code> is true for the returned list is 538 unspecified. 539 540 <p>The returned list may have unexpected behavior if it contains <code>NaN</code>, or if <code>NaN</code> is used as a parameter to any of its methods. 541 <P> 542 <DD><DL> 543 <DT><B>Parameters:</B><DD><CODE>backingArray</CODE> - the array to back the list 544 <DT><B>Returns:</B><DD>a list view of the array</DL> 545 </DD> 546 </DL> 547 <!-- ========= END OF CLASS DATA ========= --> 548 <HR> 549 550 551 <!-- ======= START OF BOTTOM NAVBAR ====== --> 552 <A NAME="navbar_bottom"><!-- --></A> 553 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 554 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 555 <TR> 556 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 557 <A NAME="navbar_bottom_firstrow"><!-- --></A> 558 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 559 <TR ALIGN="center" VALIGN="top"> 560 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 561 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 562 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 563 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Doubles.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 564 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 565 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 566 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 567 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 568 </TR> 569 </TABLE> 570 </TD> 571 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 572 </EM> 573 </TD> 574 </TR> 575 576 <TR> 577 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 578 <A HREF="../../../../com/google/common/primitives/Chars.html" title="class in com.google.common.primitives"><B>PREV CLASS</B></A> 579 <A HREF="../../../../com/google/common/primitives/Floats.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD> 580 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 581 <A HREF="../../../../index.html?com/google/common/primitives/Doubles.html" target="_top"><B>FRAMES</B></A> 582 <A HREF="Doubles.html" target="_top"><B>NO FRAMES</B></A> 583 <SCRIPT type="text/javascript"> 584 <!-- 585 if(window==top) { 586 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 587 } 588 //--> 589 </SCRIPT> 590 <NOSCRIPT> 591 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 592 </NOSCRIPT> 593 594 595 </FONT></TD> 596 </TR> 597 <TR> 598 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 599 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 600 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 601 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 602 </TR> 603 </TABLE> 604 <A NAME="skip-navbar_bottom"></A> 605 <!-- ======== END OF BOTTOM NAVBAR ======= --> 606 607 <HR> 608 609 </BODY> 610 </HTML> 611