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:47:56 PST 2010 --> 6<TITLE> 7Predicate (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"> 15function windowTitle() 16{ 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="Predicate (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/Predicate.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/base/Preconditions.html" title="class in com.google.common.base"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/base/Predicates.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../../index.html?com/google/common/base/Predicate.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Predicate.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"> 81DETAIL: 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"> 91com.google.common.base</FONT> 92<BR> 93Interface Predicate<T></H2> 94<DL> 95<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></DD> 96</DL> 97<HR> 98<DL> 99<DT><PRE>public interface <B>Predicate<T></B></DL> 100</PRE> 101 102<P> 103Determines a true or false value for a given input. For example, a 104 <code>RegexPredicate</code> might implement <code>Predicate<String></code>, and return 105 <code>true</code> for any string that matches its given regular expression. 106 107 <p>Implementations which may cause side effects upon evaluation are strongly 108 encouraged to state this fact clearly in their API documentation. 109<P> 110 111<P> 112<DL> 113<DT><B>Since:</B></DT> 114 <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD> 115<DT><B>Author:</B></DT> 116 <DD>Kevin Bourrillion</DD> 117</DL> 118<HR> 119 120<P> 121 122<!-- ========== METHOD SUMMARY =========== --> 123 124<A NAME="method_summary"><!-- --></A> 125<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 126<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 127<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 128<B>Method Summary</B></FONT></TH> 129</TR> 130<TR BGCOLOR="white" CLASS="TableRowColor"> 131<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 132<CODE> boolean</CODE></FONT></TD> 133<TD><CODE><B><A HREF="../../../../com/google/common/base/Predicate.html#apply(T)">apply</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="type parameter in Predicate">T</A> input)</CODE> 134 135<BR> 136 Applies this predicate to the given object.</TD> 137</TR> 138<TR BGCOLOR="white" CLASS="TableRowColor"> 139<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 140<CODE> boolean</CODE></FONT></TD> 141<TD><CODE><B><A HREF="../../../../com/google/common/base/Predicate.html#equals(java.lang.Object)">equals</A></B>(<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> obj)</CODE> 142 143<BR> 144 Indicates whether some other object is equal to this <code>Predicate</code>.</TD> 145</TR> 146</TABLE> 147 148<P> 149 150<!-- ============ METHOD DETAIL ========== --> 151 152<A NAME="method_detail"><!-- --></A> 153<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 154<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 155<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 156<B>Method Detail</B></FONT></TH> 157</TR> 158</TABLE> 159 160<A NAME="apply(java.lang.Object)"><!-- --></A><A NAME="apply(T)"><!-- --></A><H3> 161apply</H3> 162<PRE> 163boolean <B>apply</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT> 164 <A HREF="../../../../com/google/common/base/Predicate.html" title="type parameter in Predicate">T</A> input)</PRE> 165<DL> 166<DD>Applies this predicate to the given object. 167<P> 168<DD><DL> 169<DT><B>Parameters:</B><DD><CODE>input</CODE> - the input that the predicate should act on 170<DT><B>Returns:</B><DD>the value of this predicate when applied to the input <code>t</code></DL> 171</DD> 172</DL> 173<HR> 174 175<A NAME="equals(java.lang.Object)"><!-- --></A><H3> 176equals</H3> 177<PRE> 178boolean <B>equals</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT> 179 <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> obj)</PRE> 180<DL> 181<DD>Indicates whether some other object is equal to this <code>Predicate</code>. 182 This method can return <code>true</code> <i>only</i> if the specified object is 183 also a <code>Predicate</code> and, for every input object <code>input</code>, it 184 returns exactly the same value. Thus, <code>predicate1.equals(predicate2)</code> 185 implies that either <code>predicate1.apply(input)</code> and 186 <code>predicate2.apply(input)</code> are both <code>true</code> or both 187 <code>false</code>. 188 189 <p>Note that it is always safe <i>not</i> to override 190 <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>. 191<P> 192<DD><DL> 193<DT><B>Overrides:</B><DD><CODE><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></CODE> in class <CODE><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></DL> 194</DD> 195<DD><DL> 196</DL> 197</DD> 198</DL> 199<!-- ========= END OF CLASS DATA ========= --> 200<HR> 201 202 203<!-- ======= START OF BOTTOM NAVBAR ====== --> 204<A NAME="navbar_bottom"><!-- --></A> 205<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 206<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 207<TR> 208<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 209<A NAME="navbar_bottom_firstrow"><!-- --></A> 210<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 211 <TR ALIGN="center" VALIGN="top"> 212 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 213 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 214 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 215 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Predicate.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 216 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 217 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 218 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 219 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 220 </TR> 221</TABLE> 222</TD> 223<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 224</EM> 225</TD> 226</TR> 227 228<TR> 229<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 230 <A HREF="../../../../com/google/common/base/Preconditions.html" title="class in com.google.common.base"><B>PREV CLASS</B></A> 231 <A HREF="../../../../com/google/common/base/Predicates.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 232<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 233 <A HREF="../../../../index.html?com/google/common/base/Predicate.html" target="_top"><B>FRAMES</B></A> 234 <A HREF="Predicate.html" target="_top"><B>NO FRAMES</B></A> 235 <SCRIPT type="text/javascript"> 236 <!-- 237 if(window==top) { 238 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 239 } 240 //--> 241</SCRIPT> 242<NOSCRIPT> 243 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 244</NOSCRIPT> 245 246 247</FONT></TD> 248</TR> 249<TR> 250<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 251 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 252<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 253DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 254</TR> 255</TABLE> 256<A NAME="skip-navbar_bottom"></A> 257<!-- ======== END OF BOTTOM NAVBAR ======= --> 258 259<HR> 260 261</BODY> 262</HTML> 263