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:57 PST 2010 --> 6 <TITLE> 7 Predicates (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="Predicates (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/Predicates.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/Predicate.html" title="interface in com.google.common.base"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/base/Service.html" title="interface 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/Predicates.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Predicates.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.base</FONT> 92 <BR> 93 Class Predicates</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.base.Predicates</B> 97 </PRE> 98 <HR> 99 <DL> 100 <DT><PRE>public final class <B>Predicates</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 Contains static factory methods for creating <code>Predicate</code> instances. 105 106 <p>All methods returns serializable predicates as long as they're given 107 serializable parameters. 108 <P> 109 110 <P> 111 <DL> 112 <DT><B>Since:</B></DT> 113 <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD> 114 <DT><B>Author:</B></DT> 115 <DD>Kevin Bourrillion</DD> 116 </DL> 117 <HR> 118 119 <P> 120 121 <!-- ========== METHOD SUMMARY =========== --> 122 123 <A NAME="method_summary"><!-- --></A> 124 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 125 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 126 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 127 <B>Method Summary</B></FONT></TH> 128 </TR> 129 <TR BGCOLOR="white" CLASS="TableRowColor"> 130 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 131 <CODE>static 132 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 133 <TR ALIGN="right" VALIGN=""> 134 <TD NOWRAP><FONT SIZE="-1"> 135 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 136 </TR> 137 </TABLE> 138 </CODE></FONT></TD> 139 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#alwaysFalse()">alwaysFalse</A></B>()</CODE> 140 141 <BR> 142 Returns a predicate that always evaluates to <code>false</code>.</TD> 143 </TR> 144 <TR BGCOLOR="white" CLASS="TableRowColor"> 145 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 146 <CODE>static 147 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 148 <TR ALIGN="right" VALIGN=""> 149 <TD NOWRAP><FONT SIZE="-1"> 150 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 151 </TR> 152 </TABLE> 153 </CODE></FONT></TD> 154 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#alwaysTrue()">alwaysTrue</A></B>()</CODE> 155 156 <BR> 157 Returns a predicate that always evaluates to <code>true</code>.</TD> 158 </TR> 159 <TR BGCOLOR="white" CLASS="TableRowColor"> 160 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 161 <CODE>static 162 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 163 <TR ALIGN="right" VALIGN=""> 164 <TD NOWRAP><FONT SIZE="-1"> 165 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 166 </TR> 167 </TABLE> 168 </CODE></FONT></TD> 169 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#and(java.lang.Iterable)">and</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/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>> components)</CODE> 170 171 <BR> 172 Returns a predicate that evaluates to <code>true</code> if each of its 173 components evaluates to <code>true</code>.</TD> 174 </TR> 175 <TR BGCOLOR="white" CLASS="TableRowColor"> 176 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 177 <CODE>static 178 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 179 <TR ALIGN="right" VALIGN=""> 180 <TD NOWRAP><FONT SIZE="-1"> 181 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 182 </TR> 183 </TABLE> 184 </CODE></FONT></TD> 185 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#and(com.google.common.base.Predicate...)">and</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>... components)</CODE> 186 187 <BR> 188 Returns a predicate that evaluates to <code>true</code> if each of its 189 components evaluates to <code>true</code>.</TD> 190 </TR> 191 <TR BGCOLOR="white" CLASS="TableRowColor"> 192 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 193 <CODE>static 194 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 195 <TR ALIGN="right" VALIGN=""> 196 <TD NOWRAP><FONT SIZE="-1"> 197 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 198 </TR> 199 </TABLE> 200 </CODE></FONT></TD> 201 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#and(com.google.common.base.Predicate, com.google.common.base.Predicate)">and</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> first, 202 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> second)</CODE> 203 204 <BR> 205 Returns a predicate that evaluates to <code>true</code> if both of its 206 components evaluate to <code>true</code>.</TD> 207 </TR> 208 <TR BGCOLOR="white" CLASS="TableRowColor"> 209 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 210 <CODE>static 211 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 212 <TR ALIGN="right" VALIGN=""> 213 <TD NOWRAP><FONT SIZE="-1"> 214 <CODE><A,B> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><A></CODE></FONT></TD> 215 </TR> 216 </TABLE> 217 </CODE></FONT></TD> 218 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#compose(com.google.common.base.Predicate, com.google.common.base.Function)">compose</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><B> predicate, 219 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><A,? extends B> function)</CODE> 220 221 <BR> 222 Returns the composition of a function and a predicate.</TD> 223 </TR> 224 <TR BGCOLOR="white" CLASS="TableRowColor"> 225 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 226 <CODE>static 227 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 228 <TR ALIGN="right" VALIGN=""> 229 <TD NOWRAP><FONT SIZE="-1"> 230 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 231 </TR> 232 </TABLE> 233 </CODE></FONT></TD> 234 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#equalTo(T)">equalTo</A></B>(T target)</CODE> 235 236 <BR> 237 Returns a predicate that evaluates to <code>true</code> if the object being 238 tested <code>equals()</code> the given target or both are null.</TD> 239 </TR> 240 <TR BGCOLOR="white" CLASS="TableRowColor"> 241 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 242 <CODE>static 243 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 244 <TR ALIGN="right" VALIGN=""> 245 <TD NOWRAP><FONT SIZE="-1"> 246 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 247 </TR> 248 </TABLE> 249 </CODE></FONT></TD> 250 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#in(java.util.Collection)">in</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><? extends T> target)</CODE> 251 252 <BR> 253 Returns a predicate that evaluates to <code>true</code> if the object reference 254 being tested is a member of the given collection.</TD> 255 </TR> 256 <TR BGCOLOR="white" CLASS="TableRowColor"> 257 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 258 <CODE>static <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</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> 259 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#instanceOf(java.lang.Class)">instanceOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><?> clazz)</CODE> 260 261 <BR> 262 Returns a predicate that evaluates to <code>true</code> if the object being 263 tested is an instance of the given class.</TD> 264 </TR> 265 <TR BGCOLOR="white" CLASS="TableRowColor"> 266 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 267 <CODE>static 268 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 269 <TR ALIGN="right" VALIGN=""> 270 <TD NOWRAP><FONT SIZE="-1"> 271 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 272 </TR> 273 </TABLE> 274 </CODE></FONT></TD> 275 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#isNull()">isNull</A></B>()</CODE> 276 277 <BR> 278 Returns a predicate that evaluates to <code>true</code> if the object reference 279 being tested is null.</TD> 280 </TR> 281 <TR BGCOLOR="white" CLASS="TableRowColor"> 282 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 283 <CODE>static 284 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 285 <TR ALIGN="right" VALIGN=""> 286 <TD NOWRAP><FONT SIZE="-1"> 287 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 288 </TR> 289 </TABLE> 290 </CODE></FONT></TD> 291 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#not(com.google.common.base.Predicate)">not</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> predicate)</CODE> 292 293 <BR> 294 Returns a predicate that evaluates to <code>true</code> if the given predicate 295 evaluates to <code>false</code>.</TD> 296 </TR> 297 <TR BGCOLOR="white" CLASS="TableRowColor"> 298 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 299 <CODE>static 300 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 301 <TR ALIGN="right" VALIGN=""> 302 <TD NOWRAP><FONT SIZE="-1"> 303 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 304 </TR> 305 </TABLE> 306 </CODE></FONT></TD> 307 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#notNull()">notNull</A></B>()</CODE> 308 309 <BR> 310 Returns a predicate that evaluates to <code>true</code> if the object reference 311 being tested is not null.</TD> 312 </TR> 313 <TR BGCOLOR="white" CLASS="TableRowColor"> 314 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 315 <CODE>static 316 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 317 <TR ALIGN="right" VALIGN=""> 318 <TD NOWRAP><FONT SIZE="-1"> 319 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 320 </TR> 321 </TABLE> 322 </CODE></FONT></TD> 323 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#or(java.lang.Iterable)">or</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/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>> components)</CODE> 324 325 <BR> 326 Returns a predicate that evaluates to <code>true</code> if any one of its 327 components evaluates to <code>true</code>.</TD> 328 </TR> 329 <TR BGCOLOR="white" CLASS="TableRowColor"> 330 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 331 <CODE>static 332 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 333 <TR ALIGN="right" VALIGN=""> 334 <TD NOWRAP><FONT SIZE="-1"> 335 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 336 </TR> 337 </TABLE> 338 </CODE></FONT></TD> 339 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#or(com.google.common.base.Predicate...)">or</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>... components)</CODE> 340 341 <BR> 342 Returns a predicate that evaluates to <code>true</code> if any one of its 343 components evaluates to <code>true</code>.</TD> 344 </TR> 345 <TR BGCOLOR="white" CLASS="TableRowColor"> 346 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 347 <CODE>static 348 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 349 <TR ALIGN="right" VALIGN=""> 350 <TD NOWRAP><FONT SIZE="-1"> 351 <CODE><T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T></CODE></FONT></TD> 352 </TR> 353 </TABLE> 354 </CODE></FONT></TD> 355 <TD><CODE><B><A HREF="../../../../com/google/common/base/Predicates.html#or(com.google.common.base.Predicate, com.google.common.base.Predicate)">or</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> first, 356 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> second)</CODE> 357 358 <BR> 359 Returns a predicate that evaluates to <code>true</code> if either of its 360 components evaluates to <code>true</code>.</TD> 361 </TR> 362 </TABLE> 363 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 364 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 365 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 366 <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> 367 </TR> 368 <TR BGCOLOR="white" CLASS="TableRowColor"> 369 <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> 370 </TR> 371 </TABLE> 372 373 <P> 374 375 <!-- ============ METHOD DETAIL ========== --> 376 377 <A NAME="method_detail"><!-- --></A> 378 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 379 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 380 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 381 <B>Method Detail</B></FONT></TH> 382 </TR> 383 </TABLE> 384 385 <A NAME="alwaysTrue()"><!-- --></A><H3> 386 alwaysTrue</H3> 387 <PRE> 388 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>alwaysTrue</B>()</PRE> 389 <DL> 390 <DD>Returns a predicate that always evaluates to <code>true</code>. 391 <P> 392 <DD><DL> 393 </DL> 394 </DD> 395 </DL> 396 <HR> 397 398 <A NAME="alwaysFalse()"><!-- --></A><H3> 399 alwaysFalse</H3> 400 <PRE> 401 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>alwaysFalse</B>()</PRE> 402 <DL> 403 <DD>Returns a predicate that always evaluates to <code>false</code>. 404 <P> 405 <DD><DL> 406 </DL> 407 </DD> 408 </DL> 409 <HR> 410 411 <A NAME="isNull()"><!-- --></A><H3> 412 isNull</H3> 413 <PRE> 414 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>isNull</B>()</PRE> 415 <DL> 416 <DD>Returns a predicate that evaluates to <code>true</code> if the object reference 417 being tested is null. 418 <P> 419 <DD><DL> 420 </DL> 421 </DD> 422 </DL> 423 <HR> 424 425 <A NAME="notNull()"><!-- --></A><H3> 426 notNull</H3> 427 <PRE> 428 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>notNull</B>()</PRE> 429 <DL> 430 <DD>Returns a predicate that evaluates to <code>true</code> if the object reference 431 being tested is not null. 432 <P> 433 <DD><DL> 434 </DL> 435 </DD> 436 </DL> 437 <HR> 438 439 <A NAME="not(com.google.common.base.Predicate)"><!-- --></A><H3> 440 not</H3> 441 <PRE> 442 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>not</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> predicate)</PRE> 443 <DL> 444 <DD>Returns a predicate that evaluates to <code>true</code> if the given predicate 445 evaluates to <code>false</code>. 446 <P> 447 <DD><DL> 448 </DL> 449 </DD> 450 </DL> 451 <HR> 452 453 <A NAME="and(java.lang.Iterable)"><!-- --></A><H3> 454 and</H3> 455 <PRE> 456 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>and</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/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>> components)</PRE> 457 <DL> 458 <DD>Returns a predicate that evaluates to <code>true</code> if each of its 459 components evaluates to <code>true</code>. The components are evaluated in 460 order, and evaluation will be "short-circuited" as soon as a false 461 predicate is found. It defensively copies the iterable passed in, so future 462 changes to it won't alter the behavior of this predicate. If <code>components</code> is empty, the returned predicate will always evaluate to <code>true</code>. 463 <P> 464 <DD><DL> 465 </DL> 466 </DD> 467 </DL> 468 <HR> 469 470 <A NAME="and(com.google.common.base.Predicate...)"><!-- --></A><H3> 471 and</H3> 472 <PRE> 473 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>and</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>... components)</PRE> 474 <DL> 475 <DD>Returns a predicate that evaluates to <code>true</code> if each of its 476 components evaluates to <code>true</code>. The components are evaluated in 477 order, and evaluation will be "short-circuited" as soon as a false 478 predicate is found. It defensively copies the array passed in, so future 479 changes to it won't alter the behavior of this predicate. If <code>components</code> is empty, the returned predicate will always evaluate to <code>true</code>. 480 <P> 481 <DD><DL> 482 </DL> 483 </DD> 484 </DL> 485 <HR> 486 487 <A NAME="and(com.google.common.base.Predicate, com.google.common.base.Predicate)"><!-- --></A><H3> 488 and</H3> 489 <PRE> 490 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>and</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> first, 491 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> second)</PRE> 492 <DL> 493 <DD>Returns a predicate that evaluates to <code>true</code> if both of its 494 components evaluate to <code>true</code>. The components are evaluated in 495 order, and evaluation will be "short-circuited" as soon as a false 496 predicate is found. 497 <P> 498 <DD><DL> 499 </DL> 500 </DD> 501 </DL> 502 <HR> 503 504 <A NAME="or(java.lang.Iterable)"><!-- --></A><H3> 505 or</H3> 506 <PRE> 507 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>or</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/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>> components)</PRE> 508 <DL> 509 <DD>Returns a predicate that evaluates to <code>true</code> if any one of its 510 components evaluates to <code>true</code>. The components are evaluated in 511 order, and evaluation will be "short-circuited" as soon as as soon as a 512 true predicate is found. It defensively copies the iterable passed in, so 513 future changes to it won't alter the behavior of this predicate. If <code>components</code> is empty, the returned predicate will always evaluate to <code>false</code>. 514 <P> 515 <DD><DL> 516 </DL> 517 </DD> 518 </DL> 519 <HR> 520 521 <A NAME="or(com.google.common.base.Predicate...)"><!-- --></A><H3> 522 or</H3> 523 <PRE> 524 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>or</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T>... components)</PRE> 525 <DL> 526 <DD>Returns a predicate that evaluates to <code>true</code> if any one of its 527 components evaluates to <code>true</code>. The components are evaluated in 528 order, and evaluation will be "short-circuited" as soon as as soon as a 529 true predicate is found. It defensively copies the array passed in, so 530 future changes to it won't alter the behavior of this predicate. If <code>components</code> is empty, the returned predicate will always evaluate to <code>false</code>. 531 <P> 532 <DD><DL> 533 </DL> 534 </DD> 535 </DL> 536 <HR> 537 538 <A NAME="or(com.google.common.base.Predicate, com.google.common.base.Predicate)"><!-- --></A><H3> 539 or</H3> 540 <PRE> 541 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>or</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> first, 542 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> second)</PRE> 543 <DL> 544 <DD>Returns a predicate that evaluates to <code>true</code> if either of its 545 components evaluates to <code>true</code>. The components are evaluated in 546 order, and evaluation will be "short-circuited" as soon as as soon as a 547 true predicate is found. 548 <P> 549 <DD><DL> 550 </DL> 551 </DD> 552 </DL> 553 <HR> 554 555 <A NAME="equalTo(java.lang.Object)"><!-- --></A><A NAME="equalTo(T)"><!-- --></A><H3> 556 equalTo</H3> 557 <PRE> 558 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>equalTo</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> 559 T target)</PRE> 560 <DL> 561 <DD>Returns a predicate that evaluates to <code>true</code> if the object being 562 tested <code>equals()</code> the given target or both are null. 563 <P> 564 <DD><DL> 565 </DL> 566 </DD> 567 </DL> 568 <HR> 569 570 <A NAME="instanceOf(java.lang.Class)"><!-- --></A><H3> 571 instanceOf</H3> 572 <PRE> 573 public static <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</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>instanceOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><?> clazz)</PRE> 574 <DL> 575 <DD>Returns a predicate that evaluates to <code>true</code> if the object being 576 tested is an instance of the given class. If the object being tested 577 is <code>null</code> this predicate evaluates to <code>false</code>. 578 579 <p>If you want to filter an <code>Iterable</code> to narrow its type, consider 580 using <A HREF="../../../../com/google/common/collect/Iterables.html#filter(java.lang.Iterable, java.lang.Class)"><CODE>Iterables.filter(Iterable, Class)</CODE></A> 581 in preference. 582 <P> 583 <DD><DL> 584 </DL> 585 </DD> 586 </DL> 587 <HR> 588 589 <A NAME="in(java.util.Collection)"><!-- --></A><H3> 590 in</H3> 591 <PRE> 592 public static <T> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><T> <B>in</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><? extends T> target)</PRE> 593 <DL> 594 <DD>Returns a predicate that evaluates to <code>true</code> if the object reference 595 being tested is a member of the given collection. It does not defensively 596 copy the collection passed in, so future changes to it will alter the 597 behavior of the predicate. 598 599 This method can technically accept any Collection<?>, but using a typed 600 collection helps prevent bugs. This approach doesn't block any potential 601 users since it is always possible to use <code>Predicates.<Object>in()</code>. 602 <P> 603 <DD><DL> 604 <DT><B>Parameters:</B><DD><CODE>target</CODE> - the collection that may contain the function input</DL> 605 </DD> 606 </DL> 607 <HR> 608 609 <A NAME="compose(com.google.common.base.Predicate, com.google.common.base.Function)"><!-- --></A><H3> 610 compose</H3> 611 <PRE> 612 public static <A,B> <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><A> <B>compose</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><B> predicate, 613 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><A,? extends B> function)</PRE> 614 <DL> 615 <DD>Returns the composition of a function and a predicate. For every <code>x</code>, 616 the generated predicate returns <code>predicate(function(x))</code>. 617 <P> 618 <DD><DL> 619 620 <DT><B>Returns:</B><DD>the composition of the provided function and predicate</DL> 621 </DD> 622 </DL> 623 <!-- ========= END OF CLASS DATA ========= --> 624 <HR> 625 626 627 <!-- ======= START OF BOTTOM NAVBAR ====== --> 628 <A NAME="navbar_bottom"><!-- --></A> 629 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 630 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 631 <TR> 632 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 633 <A NAME="navbar_bottom_firstrow"><!-- --></A> 634 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 635 <TR ALIGN="center" VALIGN="top"> 636 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 637 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 638 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 639 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Predicates.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 640 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 641 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 642 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 643 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 644 </TR> 645 </TABLE> 646 </TD> 647 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 648 </EM> 649 </TD> 650 </TR> 651 652 <TR> 653 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 654 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base"><B>PREV CLASS</B></A> 655 <A HREF="../../../../com/google/common/base/Service.html" title="interface in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 656 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 657 <A HREF="../../../../index.html?com/google/common/base/Predicates.html" target="_top"><B>FRAMES</B></A> 658 <A HREF="Predicates.html" target="_top"><B>NO FRAMES</B></A> 659 <SCRIPT type="text/javascript"> 660 <!-- 661 if(window==top) { 662 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 663 } 664 //--> 665 </SCRIPT> 666 <NOSCRIPT> 667 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 668 </NOSCRIPT> 669 670 671 </FONT></TD> 672 </TR> 673 <TR> 674 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 675 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 676 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 677 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 678 </TR> 679 </TABLE> 680 <A NAME="skip-navbar_bottom"></A> 681 <!-- ======== END OF BOTTOM NAVBAR ======= --> 682 683 <HR> 684 685 </BODY> 686 </HTML> 687