| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!--NewPage--> |
| <HTML> |
| <HEAD> |
| <!-- Generated by javadoc (build 1.6.0-google-internal) on Wed Dec 09 09:28:17 PST 2009 --> |
| <TITLE> |
| Ordering (Google Collections Library 1.0-rc5) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2009-12-09"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Ordering (Google Collections Library 1.0-rc5)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_top_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> </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/Ordering.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-all.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> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../com/google/common/collect/ObjectArrays.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> |
| <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../index.html?com/google/common/collect/Ordering.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="Ordering.html" target="_top"><B>NO FRAMES</B></A> |
| <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: NESTED | 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> |
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| |
| <HR> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <H2> |
| <FONT SIZE="-1"> |
| com.google.common.collect</FONT> |
| <BR> |
| Class Ordering<T></H2> |
| <PRE> |
| <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> |
| <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.collect.Ordering<T></B> |
| </PRE> |
| <DL> |
| <DT><B>All Implemented Interfaces:</B> <DD><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><T></DD> |
| </DL> |
| <HR> |
| <DL> |
| <DT><PRE>public abstract class <B>Ordering<T></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><DT>implements <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><T></DL> |
| </PRE> |
| |
| <P> |
| A comparator with added methods to support common functions. For example: |
| <pre> <code>if (Ordering.from(comparator).reverse().isOrdered(list)) { ... }</code></pre> |
| |
| <p>The <A HREF="../../../../com/google/common/collect/Ordering.html#from(java.util.Comparator)"><CODE>from(Comparator)</CODE></A> method returns the equivalent <code>Ordering</code> instance for a pre-existing comparator. You can also skip the |
| comparator step and extend <code>Ordering</code> directly: <pre> <code>Ordering<String> byLengthOrdering = new Ordering<String>() { |
| public int compare(String left, String right) { |
| return Ints.compare(left.length(), right.length()); |
| } |
| };</code></pre> |
| |
| Except as noted, the orderings returned by the factory methods of this |
| class are serializable if and only if the provided instances that back them |
| are. For example, if <code>ordering</code> and <code>function</code> can themselves be |
| serialized, then <code>ordering.onResultOf(function)</code> can as well. |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Author:</B></DT> |
| <DD>Jesse Wilson, Kevin Bourrillion</DD> |
| </DL> |
| <HR> |
| |
| <P> |
| |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| |
| <A NAME="constructor_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Constructor Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#Ordering()">Ordering</A></B>()</CODE> |
| |
| <BR> |
| Constructs a new instance of this class (only invokable by the subclass |
| constructor, typically implicit).</TD> |
| </TR> |
| </TABLE> |
| |
| <!-- ========== METHOD SUMMARY =========== --> |
| |
| <A NAME="method_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Method Summary</B></FONT></TH> |
| </TR> |
| <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="../../../../com/google/common/collect/Ordering.html#binarySearch(java.util.List, T)">binarySearch</A></B>(<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><? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> sortedList, |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A> key)</CODE> |
| |
| <BR> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#binarySearch(java.util.List, T, java.util.Comparator)" title="class or interface in java.util"><CODE>Searches</CODE></A> |
| <code>sortedList</code> for <code>key</code> using the binary search algorithm.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><U extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><U></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#compound(java.util.Comparator)">compound</A></B>(<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><? super U> secondaryComparator)</CODE> |
| |
| <BR> |
| Returns an ordering which first uses the ordering <code>this</code>, but which |
| in the event of a "tie", then delegates to <code>secondaryComparator</code>.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#compound(java.lang.Iterable)">compound</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <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><? super T>> comparators)</CODE> |
| |
| <BR> |
| Returns an ordering which tries each given comparator in order until a |
| non-zero result is found, returning that result, and returning zero only if |
| all comparators return zero.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#explicit(java.util.List)">explicit</A></B>(<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><T> valuesInOrder)</CODE> |
| |
| <BR> |
| Returns an ordering that compares objects according to the order in |
| which they appear in the given list.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#explicit(T, T...)">explicit</A></B>(T leastValue, |
| T... remainingValuesInOrder)</CODE> |
| |
| <BR> |
| Returns an ordering that compares objects according to the order in |
| which they are given to this method.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#from(java.util.Comparator)">from</A></B>(<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><T> comparator)</CODE> |
| |
| <BR> |
| Returns an ordering for a pre-existing <code>comparator</code>.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#from(com.google.common.collect.Ordering)">from</A></B>(<A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> ordering)</CODE> |
| |
| <BR> |
| <B>Deprecated.</B> <I>no need to use this</I></TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#isOrdered(java.lang.Iterable)">isOrdered</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> iterable)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if each element in <code>iterable</code> after the first is |
| greater than or equal to the element that preceded it, according to this |
| ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#isStrictlyOrdered(java.lang.Iterable)">isStrictlyOrdered</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> iterable)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if each element in <code>iterable</code> after the first is |
| <i>strictly</i> greater than the element that preceded it, according to |
| this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| E</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#max(E, E)">max</A></B>(E a, |
| E b)</CODE> |
| |
| <BR> |
| Returns the larger of the two values according to this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| E</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#max(E, E, E, E...)">max</A></B>(E a, |
| E b, |
| E c, |
| E... rest)</CODE> |
| |
| <BR> |
| Returns the largest of the specified values according to this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| E</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#max(java.lang.Iterable)">max</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><E> iterable)</CODE> |
| |
| <BR> |
| Returns the largest of the specified values according to this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| E</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#min(E, E)">min</A></B>(E a, |
| E b)</CODE> |
| |
| <BR> |
| Returns the smaller of the two values according to this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| E</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#min(E, E, E, E...)">min</A></B>(E a, |
| E b, |
| E c, |
| E... rest)</CODE> |
| |
| <BR> |
| Returns the smallest of the specified values according to this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| E</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#min(java.lang.Iterable)">min</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><E> iterable)</CODE> |
| |
| <BR> |
| Returns the smallest of the specified values according to this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><C extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>> |
| <BR> |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><C></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#natural()">natural</A></B>()</CODE> |
| |
| <BR> |
| Returns a serializable ordering that uses the natural order of the values.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><S extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><S></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#nullsFirst()">nullsFirst</A></B>()</CODE> |
| |
| <BR> |
| Returns an ordering that treats <code>null</code> as less than all other values |
| and uses <code>this</code> to compare non-null values.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><S extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><S></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#nullsLast()">nullsLast</A></B>()</CODE> |
| |
| <BR> |
| Returns an ordering that treats <code>null</code> as greater than all other |
| values and uses this ordering to compare non-null values.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><F> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><F></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#onResultOf(com.google.common.base.Function)">onResultOf</A></B>(<A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><F,? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> function)</CODE> |
| |
| <BR> |
| Returns a new ordering on <code>F</code> which orders elements by first applying |
| a function to them, then comparing those results using <code>this</code>.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><S extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><S></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#reverse()">reverse</A></B>()</CODE> |
| |
| <BR> |
| Returns the reverse of this ordering; the <code>Ordering</code> equivalent to |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#reverseOrder(java.util.Comparator)" title="class or interface in java.util"><CODE>Collections.reverseOrder(Comparator)</CODE></A>.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> |
| <BR> |
| <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><E></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#sortedCopy(java.lang.Iterable)">sortedCopy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><E> iterable)</CODE> |
| |
| <BR> |
| Returns a copy of the given iterable sorted by this ordering.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><<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>></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../com/google/common/collect/Ordering.html#usingToString()">usingToString</A></B>()</CODE> |
| |
| <BR> |
| Returns an ordering that compares objects by the natural ordering of their |
| string representations as returned by <code>toString()</code>.</TD> |
| </TR> |
| </TABLE> |
| <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> |
| <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> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <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> |
| </TR> |
| </TABLE> |
| <A NAME="methods_inherited_from_class_java.util.Comparator"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> |
| <TH ALIGN="left"><B>Methods inherited from interface java.util.<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></B></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true#compare(T, T)" title="class or interface in java.util">compare</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.util">equals</A></CODE></TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| |
| <A NAME="constructor_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| <B>Constructor Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="Ordering()"><!-- --></A><H3> |
| Ordering</H3> |
| <PRE> |
| protected <B>Ordering</B>()</PRE> |
| <DL> |
| <DD>Constructs a new instance of this class (only invokable by the subclass |
| constructor, typically implicit). |
| <P> |
| </DL> |
| |
| <!-- ============ METHOD DETAIL ========== --> |
| |
| <A NAME="method_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| <B>Method Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="natural()"><!-- --></A><H3> |
| natural</H3> |
| <PRE> |
| public static <C extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><C> <B>natural</B>()</PRE> |
| <DL> |
| <DD>Returns a serializable ordering that uses the natural order of the values. |
| The ordering throws 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> when passed a null |
| parameter. |
| |
| <p>The type specification is <code><C extends Comparable></code>, instead of |
| the technically correct <code><C extends Comparable<? super C>></code>, to |
| support legacy types from before Java 5. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="from(java.util.Comparator)"><!-- --></A><H3> |
| from</H3> |
| <PRE> |
| public static <T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> <B>from</B>(<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><T> comparator)</PRE> |
| <DL> |
| <DD>Returns an ordering for a pre-existing <code>comparator</code>. Note |
| that if the comparator is not pre-existing, and you don't require |
| serialization, you can subclass <code>Ordering</code> and implement its |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true#compare(T, T)" title="class or interface in java.util"><CODE>compare</CODE></A> method instead. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>comparator</CODE> - the comparator that defines the order</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="from(com.google.common.collect.Ordering)"><!-- --></A><H3> |
| from</H3> |
| <PRE> |
| <FONT SIZE="-1"><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</A> |
| </FONT>public static <T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> <B>from</B>(<A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> ordering)</PRE> |
| <DL> |
| <DD><B>Deprecated.</B> <I>no need to use this</I> |
| <P> |
| <DD>Simply returns its argument. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="explicit(java.util.List)"><!-- --></A><H3> |
| explicit</H3> |
| <PRE> |
| public static <T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> <B>explicit</B>(<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><T> valuesInOrder)</PRE> |
| <DL> |
| <DD>Returns an ordering that compares objects according to the order in |
| which they appear in the given list. Only objects present in the list |
| (according to <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(java.lang.Object)</CODE></A>) may be compared. This comparator |
| imposes a "partial ordering" over the type <code>T</code>. Subsequent changes |
| to the <code>valuesInOrder</code> list will have no effect on the returned |
| comparator. Null values in the list are not supported. |
| |
| <p>The returned comparator throws an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang"><CODE>ClassCastException</CODE></A> when it |
| receives an input parameter that isn't among the provided values. |
| |
| <p>The generated comparator is serializable if all the provided values are |
| serializable. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>valuesInOrder</CODE> - the values that the returned comparator will be able |
| to compare, in the order the comparator should induce |
| <DT><B>Returns:</B><DD>the comparator described above |
| <DT><B>Throws:</B> |
| <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 any of the provided values is null |
| <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>valuesInOrder</code> contains any |
| duplicate values (according to <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(java.lang.Object)</CODE></A>)</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="explicit(java.lang.Object,java.lang.Object[])"><!-- --></A><A NAME="explicit(T, T...)"><!-- --></A><H3> |
| explicit</H3> |
| <PRE> |
| public static <T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> <B>explicit</B>(T leastValue, |
| T... remainingValuesInOrder)</PRE> |
| <DL> |
| <DD>Returns an ordering that compares objects according to the order in |
| which they are given to this method. Only objects present in the argument |
| list (according to <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(java.lang.Object)</CODE></A>) may be compared. This comparator |
| imposes a "partial ordering" over the type <code>T</code>. Null values in the |
| argument list are not supported. |
| |
| <p>The returned comparator throws a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang"><CODE>ClassCastException</CODE></A> when it |
| receives an input parameter that isn't among the provided values. |
| |
| <p>The generated comparator is serializable if all the provided values are |
| serializable. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>leastValue</CODE> - the value which the returned comparator should consider |
| the "least" of all values<DD><CODE>remainingValuesInOrder</CODE> - the rest of the values that the returned |
| comparator will be able to compare, in the order the comparator should |
| follow |
| <DT><B>Returns:</B><DD>the comparator described above |
| <DT><B>Throws:</B> |
| <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 any of the provided values is null |
| <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 any duplicate values (according to |
| <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>) are present among the method arguments</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="usingToString()"><!-- --></A><H3> |
| usingToString</H3> |
| <PRE> |
| public static <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><<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>usingToString</B>()</PRE> |
| <DL> |
| <DD>Returns an ordering that compares objects by the natural ordering of their |
| string representations as returned by <code>toString()</code>. It does not |
| support null values. |
| |
| <p>The comparator is serializable. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="compound(java.lang.Iterable)"><!-- --></A><H3> |
| compound</H3> |
| <PRE> |
| public static <T> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><T> <B>compound</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <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><? super T>> comparators)</PRE> |
| <DL> |
| <DD>Returns an ordering which tries each given comparator in order until a |
| non-zero result is found, returning that result, and returning zero only if |
| all comparators return zero. The returned ordering is based on the state of |
| the <code>comparators</code> iterable at the time it was provided to this |
| method. |
| |
| <p>The returned ordering is equivalent to that produced using <code>Ordering.from(comp1).compound(comp2).compound(comp3) . . .</code>. |
| |
| <p><b>Warning:</b> Supplying an argument with undefined iteration order, |
| such as a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util"><CODE>HashSet</CODE></A>, will produce non-deterministic results. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>comparators</CODE> - the comparators to try in order</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="compound(java.util.Comparator)"><!-- --></A><H3> |
| compound</H3> |
| <PRE> |
| public <U extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><U> <B>compound</B>(<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><? super U> secondaryComparator)</PRE> |
| <DL> |
| <DD>Returns an ordering which first uses the ordering <code>this</code>, but which |
| in the event of a "tie", then delegates to <code>secondaryComparator</code>. |
| For example, to sort a bug list first by status and second by priority, you |
| might use <code>byStatus.compound(byPriority)</code>. For a compound ordering |
| with three or more components, simply chain multiple calls to this method. |
| |
| <p>An ordering produced by this method, or a chain of calls to this method, |
| is equivalent to one created using <A HREF="../../../../com/google/common/collect/Ordering.html#compound(java.lang.Iterable)"><CODE>compound(Iterable)</CODE></A> on |
| the same component comparators. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="reverse()"><!-- --></A><H3> |
| reverse</H3> |
| <PRE> |
| public <S extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><S> <B>reverse</B>()</PRE> |
| <DL> |
| <DD>Returns the reverse of this ordering; the <code>Ordering</code> equivalent to |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#reverseOrder(java.util.Comparator)" title="class or interface in java.util"><CODE>Collections.reverseOrder(Comparator)</CODE></A>. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="onResultOf(com.google.common.base.Function)"><!-- --></A><H3> |
| onResultOf</H3> |
| <PRE> |
| public <F> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><F> <B>onResultOf</B>(<A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><F,? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> function)</PRE> |
| <DL> |
| <DD>Returns a new ordering on <code>F</code> which orders elements by first applying |
| a function to them, then comparing those results using <code>this</code>. For |
| example, to compare objects by their string forms, in a case-insensitive |
| manner, use: <pre> <code>Ordering.from(String.CASE_INSENSITIVE_ORDER) |
| .onResultOf(Functions.toStringFunction())</code></pre> |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="nullsFirst()"><!-- --></A><H3> |
| nullsFirst</H3> |
| <PRE> |
| public <S extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><S> <B>nullsFirst</B>()</PRE> |
| <DL> |
| <DD>Returns an ordering that treats <code>null</code> as less than all other values |
| and uses <code>this</code> to compare non-null values. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="nullsLast()"><!-- --></A><H3> |
| nullsLast</H3> |
| <PRE> |
| public <S extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> <A HREF="../../../../com/google/common/collect/Ordering.html" title="class in com.google.common.collect">Ordering</A><S> <B>nullsLast</B>()</PRE> |
| <DL> |
| <DD>Returns an ordering that treats <code>null</code> as greater than all other |
| values and uses this ordering to compare non-null values. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="binarySearch(java.util.List,java.lang.Object)"><!-- --></A><A NAME="binarySearch(java.util.List, T)"><!-- --></A><H3> |
| binarySearch</H3> |
| <PRE> |
| public int <B>binarySearch</B>(<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><? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> sortedList, |
| <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A> key)</PRE> |
| <DL> |
| <DD><A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#binarySearch(java.util.List, T, java.util.Comparator)" title="class or interface in java.util"><CODE>Searches</CODE></A> |
| <code>sortedList</code> for <code>key</code> using the binary search algorithm. The |
| list must be sorted using this ordering. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>sortedList</CODE> - the list to be searched<DD><CODE>key</CODE> - the key to be searched for</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="sortedCopy(java.lang.Iterable)"><!-- --></A><H3> |
| sortedCopy</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> <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><E> <B>sortedCopy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><E> iterable)</PRE> |
| <DL> |
| <DD>Returns a copy of the given iterable sorted by this ordering. The input is |
| not modified. The returned list is modifiable, serializable, and has random |
| access. |
| |
| <p>Unlike <A HREF="../../../../com/google/common/collect/Sets.html#newTreeSet(java.lang.Iterable)"><CODE>Sets.newTreeSet(Iterable)</CODE></A>, this method does not collapse |
| elements that compare as zero, and the resulting collection does not |
| maintain its own sort order. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the elements to be copied and sorted |
| <DT><B>Returns:</B><DD>a new list containing the given elements in sorted order</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isOrdered(java.lang.Iterable)"><!-- --></A><H3> |
| isOrdered</H3> |
| <PRE> |
| public boolean <B>isOrdered</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> iterable)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if each element in <code>iterable</code> after the first is |
| greater than or equal to the element that preceded it, according to this |
| ordering. Note that this is always true when the iterable has fewer than |
| two elements. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isStrictlyOrdered(java.lang.Iterable)"><!-- --></A><H3> |
| isStrictlyOrdered</H3> |
| <PRE> |
| public boolean <B>isStrictlyOrdered</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> iterable)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if each element in <code>iterable</code> after the first is |
| <i>strictly</i> greater than the element that preceded it, according to |
| this ordering. Note that this is always true when the iterable has fewer |
| than two elements. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="max(java.lang.Iterable)"><!-- --></A><H3> |
| max</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> E <B>max</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><E> iterable)</PRE> |
| <DL> |
| <DD>Returns the largest of the specified values according to this ordering. If |
| there are multiple largest values, the first of those is returned. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable whose maximum element is to be determined |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util">NoSuchElementException</A></CODE> - if <code>iterable</code> is empty |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the parameters are not <i>mutually |
| comparable</i> under this ordering.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="max(java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object[])"><!-- --></A><A NAME="max(E, E, E, E...)"><!-- --></A><H3> |
| max</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> E <B>max</B>(E a, |
| E b, |
| E c, |
| E... rest)</PRE> |
| <DL> |
| <DD>Returns the largest of the specified values according to this ordering. If |
| there are multiple largest values, the first of those is returned. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>a</CODE> - value to compare, returned if greater than or equal to the rest.<DD><CODE>b</CODE> - value to compare<DD><CODE>c</CODE> - value to compare<DD><CODE>rest</CODE> - values to compare |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the parameters are not <i>mutually |
| comparable</i> under this ordering.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="max(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="max(E, E)"><!-- --></A><H3> |
| max</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> E <B>max</B>(E a, |
| E b)</PRE> |
| <DL> |
| <DD>Returns the larger of the two values according to this ordering. If the |
| values compare as 0, the first is returned. |
| |
| <p><b>Implementation note:</b> this method is invoked by the default |
| implementations of the other <code>max</code> overloads, so overriding it will |
| affect their behavior. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>a</CODE> - value to compare, returned if greater than or equal to b.<DD><CODE>b</CODE> - value to compare. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the parameters are not <i>mutually |
| comparable</i> under this ordering.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="min(java.lang.Iterable)"><!-- --></A><H3> |
| min</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> E <B>min</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><E> iterable)</PRE> |
| <DL> |
| <DD>Returns the smallest of the specified values according to this ordering. If |
| there are multiple smallest values, the first of those is returned. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable whose minimum element is to be determined |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util">NoSuchElementException</A></CODE> - if <code>iterable</code> is empty |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the parameters are not <i>mutually |
| comparable</i> under this ordering.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="min(java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object[])"><!-- --></A><A NAME="min(E, E, E, E...)"><!-- --></A><H3> |
| min</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> E <B>min</B>(E a, |
| E b, |
| E c, |
| E... rest)</PRE> |
| <DL> |
| <DD>Returns the smallest of the specified values according to this ordering. If |
| there are multiple smallest values, the first of those is returned. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>a</CODE> - value to compare, returned if less than or equal to the rest.<DD><CODE>b</CODE> - value to compare<DD><CODE>c</CODE> - value to compare<DD><CODE>rest</CODE> - values to compare |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the parameters are not <i>mutually |
| comparable</i> under this ordering.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="min(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="min(E, E)"><!-- --></A><H3> |
| min</H3> |
| <PRE> |
| public <E extends <A HREF="../../../../com/google/common/collect/Ordering.html" title="type parameter in Ordering">T</A>> E <B>min</B>(E a, |
| E b)</PRE> |
| <DL> |
| <DD>Returns the smaller of the two values according to this ordering. If the |
| values compare as 0, the first is returned. |
| |
| <p><b>Implementation note:</b> this method is invoked by the default |
| implementations of the other <code>min</code> overloads, so overriding it will |
| affect their behavior. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>a</CODE> - value to compare, returned if less than or equal to b.<DD><CODE>b</CODE> - value to compare. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the parameters are not <i>mutually |
| comparable</i> under this ordering.</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=2 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> </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/Ordering.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-all.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> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../com/google/common/collect/ObjectArrays.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> |
| <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../index.html?com/google/common/collect/Ordering.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="Ordering.html" target="_top"><B>NO FRAMES</B></A> |
| <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: NESTED | 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> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| |
| </BODY> |
| </HTML> |