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:59 PST 2010 --> 6 <TITLE> 7 Iterables (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="Iterables (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/Iterables.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/collect/ImmutableSortedSet.Builder.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/collect/Iterators.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> 60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../../index.html?com/google/common/collect/Iterables.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Iterables.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.collect</FONT> 92 <BR> 93 Class Iterables</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.collect.Iterables</B> 97 </PRE> 98 <HR> 99 <DL> 100 <DT><PRE>public final class <B>Iterables</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 This class contains static utility methods that operate on or return objects 105 of type <code>Iterable</code>. Except as noted, each method has a corresponding 106 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util"><CODE>Iterator</CODE></A>-based method in the <A HREF="../../../../com/google/common/collect/Iterators.html" title="class in com.google.common.collect"><CODE>Iterators</CODE></A> class. 107 <P> 108 109 <P> 110 <DL> 111 <DT><B>Since:</B></DT> 112 <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD> 113 <DT><B>Author:</B></DT> 114 <DD>Kevin Bourrillion, Jared Levy</DD> 115 </DL> 116 <HR> 117 118 <P> 119 120 <!-- ========== METHOD SUMMARY =========== --> 121 122 <A NAME="method_summary"><!-- --></A> 123 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 124 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 125 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 126 <B>Method Summary</B></FONT></TH> 127 </TR> 128 <TR BGCOLOR="white" CLASS="TableRowColor"> 129 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 130 <CODE>static 131 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 132 <TR ALIGN="right" VALIGN=""> 133 <TD NOWRAP><FONT SIZE="-1"> 134 <CODE><T> boolean</CODE></FONT></TD> 135 </TR> 136 </TABLE> 137 </CODE></FONT></TD> 138 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#addAll(java.util.Collection, java.lang.Iterable)">addAll</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><T> addTo, 139 <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 T> elementsToAdd)</CODE> 140 141 <BR> 142 Adds all elements in <code>iterable</code> to <code>collection</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> boolean</CODE></FONT></TD> 151 </TR> 152 </TABLE> 153 </CODE></FONT></TD> 154 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#all(java.lang.Iterable, com.google.common.base.Predicate)">all</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><T> iterable, 155 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> 156 157 <BR> 158 Returns <code>true</code> if every element in <code>iterable</code> satisfies the 159 predicate.</TD> 160 </TR> 161 <TR BGCOLOR="white" CLASS="TableRowColor"> 162 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 163 <CODE>static 164 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 165 <TR ALIGN="right" VALIGN=""> 166 <TD NOWRAP><FONT SIZE="-1"> 167 <CODE><T> boolean</CODE></FONT></TD> 168 </TR> 169 </TABLE> 170 </CODE></FONT></TD> 171 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#any(java.lang.Iterable, com.google.common.base.Predicate)">any</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><T> iterable, 172 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> 173 174 <BR> 175 Returns <code>true</code> if one or more elements in <code>iterable</code> satisfy 176 the predicate.</TD> 177 </TR> 178 <TR BGCOLOR="white" CLASS="TableRowColor"> 179 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 180 <CODE>static 181 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 182 <TR ALIGN="right" VALIGN=""> 183 <TD NOWRAP><FONT SIZE="-1"> 184 <CODE><T> <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><T></CODE></FONT></TD> 185 </TR> 186 </TABLE> 187 </CODE></FONT></TD> 188 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#concat(java.lang.Iterable)">concat</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/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends T>> inputs)</CODE> 189 190 <BR> 191 Combines multiple iterables into a single iterable.</TD> 192 </TR> 193 <TR BGCOLOR="white" CLASS="TableRowColor"> 194 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 195 <CODE>static 196 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 197 <TR ALIGN="right" VALIGN=""> 198 <TD NOWRAP><FONT SIZE="-1"> 199 <CODE><T> <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><T></CODE></FONT></TD> 200 </TR> 201 </TABLE> 202 </CODE></FONT></TD> 203 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#concat(java.lang.Iterable...)">concat</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 T>... inputs)</CODE> 204 205 <BR> 206 Combines multiple iterables into a single iterable.</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><T> <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><T></CODE></FONT></TD> 215 </TR> 216 </TABLE> 217 </CODE></FONT></TD> 218 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#concat(java.lang.Iterable, java.lang.Iterable)">concat</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 T> a, 219 <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 T> b)</CODE> 220 221 <BR> 222 Combines two iterables into a single iterable.</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="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><T></CODE></FONT></TD> 231 </TR> 232 </TABLE> 233 </CODE></FONT></TD> 234 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#concat(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)">concat</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 T> a, 235 <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 T> b, 236 <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 T> c)</CODE> 237 238 <BR> 239 Combines three iterables into a single iterable.</TD> 240 </TR> 241 <TR BGCOLOR="white" CLASS="TableRowColor"> 242 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 243 <CODE>static 244 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 245 <TR ALIGN="right" VALIGN=""> 246 <TD NOWRAP><FONT SIZE="-1"> 247 <CODE><T> <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><T></CODE></FONT></TD> 248 </TR> 249 </TABLE> 250 </CODE></FONT></TD> 251 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#concat(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)">concat</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 T> a, 252 <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 T> b, 253 <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 T> c, 254 <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 T> d)</CODE> 255 256 <BR> 257 Combines four iterables into a single iterable.</TD> 258 </TR> 259 <TR BGCOLOR="white" CLASS="TableRowColor"> 260 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 261 <CODE>static 262 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 263 <TR ALIGN="right" VALIGN=""> 264 <TD NOWRAP><FONT SIZE="-1"> 265 <CODE><T> <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><T></CODE></FONT></TD> 266 </TR> 267 </TABLE> 268 </CODE></FONT></TD> 269 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#consumingIterable(java.lang.Iterable)">consumingIterable</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><T> iterable)</CODE> 270 271 <BR> 272 Returns a view of the supplied iterable that wraps each generated 273 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util"><CODE>Iterator</CODE></A> through <A HREF="../../../../com/google/common/collect/Iterators.html#consumingIterator(java.util.Iterator)"><CODE>Iterators.consumingIterator(Iterator)</CODE></A>.</TD> 274 </TR> 275 <TR BGCOLOR="white" CLASS="TableRowColor"> 276 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 277 <CODE>static boolean</CODE></FONT></TD> 278 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#contains(java.lang.Iterable, java.lang.Object)">contains</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><?> iterable, 279 <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> element)</CODE> 280 281 <BR> 282 Returns <code>true</code> if <code>iterable</code> contains <code>element</code>; that is, 283 any object for while <code>equals(element)</code> is true.</TD> 284 </TR> 285 <TR BGCOLOR="white" CLASS="TableRowColor"> 286 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 287 <CODE>static 288 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 289 <TR ALIGN="right" VALIGN=""> 290 <TD NOWRAP><FONT SIZE="-1"> 291 <CODE><T> <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><T></CODE></FONT></TD> 292 </TR> 293 </TABLE> 294 </CODE></FONT></TD> 295 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#cycle(java.lang.Iterable)">cycle</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><T> iterable)</CODE> 296 297 <BR> 298 Returns an iterable whose iterators cycle indefinitely over the elements of 299 <code>iterable</code>.</TD> 300 </TR> 301 <TR BGCOLOR="white" CLASS="TableRowColor"> 302 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 303 <CODE>static 304 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 305 <TR ALIGN="right" VALIGN=""> 306 <TD NOWRAP><FONT SIZE="-1"> 307 <CODE><T> <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><T></CODE></FONT></TD> 308 </TR> 309 </TABLE> 310 </CODE></FONT></TD> 311 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#cycle(T...)">cycle</A></B>(T... elements)</CODE> 312 313 <BR> 314 Returns an iterable whose iterators cycle indefinitely over the provided 315 elements.</TD> 316 </TR> 317 <TR BGCOLOR="white" CLASS="TableRowColor"> 318 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 319 <CODE>static boolean</CODE></FONT></TD> 320 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#elementsEqual(java.lang.Iterable, java.lang.Iterable)">elementsEqual</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><?> iterable1, 321 <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><?> iterable2)</CODE> 322 323 <BR> 324 Determines whether two iterables contain equal elements in the same order.</TD> 325 </TR> 326 <TR BGCOLOR="white" CLASS="TableRowColor"> 327 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 328 <CODE>static 329 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 330 <TR ALIGN="right" VALIGN=""> 331 <TD NOWRAP><FONT SIZE="-1"> 332 <CODE><T> <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><T></CODE></FONT></TD> 333 </TR> 334 </TABLE> 335 </CODE></FONT></TD> 336 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#filter(java.lang.Iterable, java.lang.Class)">filter</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><?> unfiltered, 337 <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><T> type)</CODE> 338 339 <BR> 340 Returns all instances of class <code>type</code> in <code>unfiltered</code>.</TD> 341 </TR> 342 <TR BGCOLOR="white" CLASS="TableRowColor"> 343 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 344 <CODE>static 345 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 346 <TR ALIGN="right" VALIGN=""> 347 <TD NOWRAP><FONT SIZE="-1"> 348 <CODE><T> <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><T></CODE></FONT></TD> 349 </TR> 350 </TABLE> 351 </CODE></FONT></TD> 352 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#filter(java.lang.Iterable, com.google.common.base.Predicate)">filter</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><T> unfiltered, 353 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> 354 355 <BR> 356 Returns the elements of <code>unfiltered</code> that satisfy a predicate.</TD> 357 </TR> 358 <TR BGCOLOR="white" CLASS="TableRowColor"> 359 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 360 <CODE>static 361 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 362 <TR ALIGN="right" VALIGN=""> 363 <TD NOWRAP><FONT SIZE="-1"> 364 <CODE><T> T</CODE></FONT></TD> 365 </TR> 366 </TABLE> 367 </CODE></FONT></TD> 368 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#find(java.lang.Iterable, com.google.common.base.Predicate)">find</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><T> iterable, 369 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> 370 371 <BR> 372 Returns the first element in <code>iterable</code> that satisfies the given 373 predicate.</TD> 374 </TR> 375 <TR BGCOLOR="white" CLASS="TableRowColor"> 376 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 377 <CODE>static int</CODE></FONT></TD> 378 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#frequency(java.lang.Iterable, java.lang.Object)">frequency</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><?> iterable, 379 <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> element)</CODE> 380 381 <BR> 382 Returns the number of elements in the specified iterable that equal the 383 specified object.</TD> 384 </TR> 385 <TR BGCOLOR="white" CLASS="TableRowColor"> 386 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 387 <CODE>static 388 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 389 <TR ALIGN="right" VALIGN=""> 390 <TD NOWRAP><FONT SIZE="-1"> 391 <CODE><T> T</CODE></FONT></TD> 392 </TR> 393 </TABLE> 394 </CODE></FONT></TD> 395 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#get(java.lang.Iterable, int)">get</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><T> iterable, 396 int position)</CODE> 397 398 <BR> 399 Returns the element at the specified position in an iterable.</TD> 400 </TR> 401 <TR BGCOLOR="white" CLASS="TableRowColor"> 402 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 403 <CODE>static 404 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 405 <TR ALIGN="right" VALIGN=""> 406 <TD NOWRAP><FONT SIZE="-1"> 407 <CODE><T> T</CODE></FONT></TD> 408 </TR> 409 </TABLE> 410 </CODE></FONT></TD> 411 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#getLast(java.lang.Iterable)">getLast</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><T> iterable)</CODE> 412 413 <BR> 414 Returns the last element of <code>iterable</code>.</TD> 415 </TR> 416 <TR BGCOLOR="white" CLASS="TableRowColor"> 417 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 418 <CODE>static 419 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 420 <TR ALIGN="right" VALIGN=""> 421 <TD NOWRAP><FONT SIZE="-1"> 422 <CODE><T> T</CODE></FONT></TD> 423 </TR> 424 </TABLE> 425 </CODE></FONT></TD> 426 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#getOnlyElement(java.lang.Iterable)">getOnlyElement</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><T> iterable)</CODE> 427 428 <BR> 429 Returns the single element contained in <code>iterable</code>.</TD> 430 </TR> 431 <TR BGCOLOR="white" CLASS="TableRowColor"> 432 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 433 <CODE>static 434 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 435 <TR ALIGN="right" VALIGN=""> 436 <TD NOWRAP><FONT SIZE="-1"> 437 <CODE><T> T</CODE></FONT></TD> 438 </TR> 439 </TABLE> 440 </CODE></FONT></TD> 441 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#getOnlyElement(java.lang.Iterable, T)">getOnlyElement</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><T> iterable, 442 T defaultValue)</CODE> 443 444 <BR> 445 Returns the single element contained in <code>iterable</code>, or <code>defaultValue</code> if the iterable is empty.</TD> 446 </TR> 447 <TR BGCOLOR="white" CLASS="TableRowColor"> 448 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 449 <CODE>static 450 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 451 <TR ALIGN="right" VALIGN=""> 452 <TD NOWRAP><FONT SIZE="-1"> 453 <CODE><T> int</CODE></FONT></TD> 454 </TR> 455 </TABLE> 456 </CODE></FONT></TD> 457 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#indexOf(java.lang.Iterable, com.google.common.base.Predicate)">indexOf</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><T> iterable, 458 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> 459 460 <BR> 461 Returns the index in <code>iterable</code> of the first element that satisfies 462 the provided <code>predicate</code>, or <code>-1</code> if the Iterable has no such 463 elements.</TD> 464 </TR> 465 <TR BGCOLOR="white" CLASS="TableRowColor"> 466 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 467 <CODE>static 468 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 469 <TR ALIGN="right" VALIGN=""> 470 <TD NOWRAP><FONT SIZE="-1"> 471 <CODE><T> boolean</CODE></FONT></TD> 472 </TR> 473 </TABLE> 474 </CODE></FONT></TD> 475 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#isEmpty(java.lang.Iterable)">isEmpty</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><T> iterable)</CODE> 476 477 <BR> 478 Determines if the given iterable contains no elements.</TD> 479 </TR> 480 <TR BGCOLOR="white" CLASS="TableRowColor"> 481 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 482 <CODE>static 483 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 484 <TR ALIGN="right" VALIGN=""> 485 <TD NOWRAP><FONT SIZE="-1"> 486 <CODE><T> <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><<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>></CODE></FONT></TD> 487 </TR> 488 </TABLE> 489 </CODE></FONT></TD> 490 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#paddedPartition(java.lang.Iterable, int)">paddedPartition</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><T> iterable, 491 int size)</CODE> 492 493 <BR> 494 Divides an iterable into unmodifiable sublists of the given size, padding 495 the final iterable with null values if necessary.</TD> 496 </TR> 497 <TR BGCOLOR="white" CLASS="TableRowColor"> 498 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 499 <CODE>static 500 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 501 <TR ALIGN="right" VALIGN=""> 502 <TD NOWRAP><FONT SIZE="-1"> 503 <CODE><T> <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><<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>></CODE></FONT></TD> 504 </TR> 505 </TABLE> 506 </CODE></FONT></TD> 507 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#partition(java.lang.Iterable, int)">partition</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><T> iterable, 508 int size)</CODE> 509 510 <BR> 511 Divides an iterable into unmodifiable sublists of the given size (the final 512 iterable may be smaller).</TD> 513 </TR> 514 <TR BGCOLOR="white" CLASS="TableRowColor"> 515 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 516 <CODE>static boolean</CODE></FONT></TD> 517 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#removeAll(java.lang.Iterable, java.util.Collection)">removeAll</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><?> removeFrom, 518 <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><?> elementsToRemove)</CODE> 519 520 <BR> 521 Removes, from an iterable, every element that belongs to the provided 522 collection.</TD> 523 </TR> 524 <TR BGCOLOR="white" CLASS="TableRowColor"> 525 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 526 <CODE>static 527 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 528 <TR ALIGN="right" VALIGN=""> 529 <TD NOWRAP><FONT SIZE="-1"> 530 <CODE><T> boolean</CODE></FONT></TD> 531 </TR> 532 </TABLE> 533 </CODE></FONT></TD> 534 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#removeIf(java.lang.Iterable, com.google.common.base.Predicate)">removeIf</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><T> removeFrom, 535 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> 536 537 <BR> 538 Removes, from an iterable, every element that satisfies the provided 539 predicate.</TD> 540 </TR> 541 <TR BGCOLOR="white" CLASS="TableRowColor"> 542 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 543 <CODE>static boolean</CODE></FONT></TD> 544 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#retainAll(java.lang.Iterable, java.util.Collection)">retainAll</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><?> removeFrom, 545 <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><?> elementsToRetain)</CODE> 546 547 <BR> 548 Removes, from an iterable, every element that does not belong to the 549 provided collection.</TD> 550 </TR> 551 <TR BGCOLOR="white" CLASS="TableRowColor"> 552 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 553 <CODE>static 554 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 555 <TR ALIGN="right" VALIGN=""> 556 <TD NOWRAP><FONT SIZE="-1"> 557 <CODE><T> <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><T></CODE></FONT></TD> 558 </TR> 559 </TABLE> 560 </CODE></FONT></TD> 561 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#reverse(java.util.List)">reverse</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> list)</CODE> 562 563 <BR> 564 Adapts a list to an iterable with reversed iteration order.</TD> 565 </TR> 566 <TR BGCOLOR="white" CLASS="TableRowColor"> 567 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 568 <CODE>static int</CODE></FONT></TD> 569 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#size(java.lang.Iterable)">size</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><?> iterable)</CODE> 570 571 <BR> 572 Returns the number of elements in <code>iterable</code>.</TD> 573 </TR> 574 <TR BGCOLOR="white" CLASS="TableRowColor"> 575 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 576 <CODE>static 577 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 578 <TR ALIGN="right" VALIGN=""> 579 <TD NOWRAP><FONT SIZE="-1"> 580 <CODE><T> T[]</CODE></FONT></TD> 581 </TR> 582 </TABLE> 583 </CODE></FONT></TD> 584 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#toArray(java.lang.Iterable, java.lang.Class)">toArray</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 T> iterable, 585 <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><T> type)</CODE> 586 587 <BR> 588 Copies an iterable's elements into an array.</TD> 589 </TR> 590 <TR BGCOLOR="white" CLASS="TableRowColor"> 591 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 592 <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 593 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#toString(java.lang.Iterable)">toString</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><?> iterable)</CODE> 594 595 <BR> 596 Returns a string representation of <code>iterable</code>, with the format 597 <code>[e1, e2, ..., en]</code>.</TD> 598 </TR> 599 <TR BGCOLOR="white" CLASS="TableRowColor"> 600 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 601 <CODE>static 602 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 603 <TR ALIGN="right" VALIGN=""> 604 <TD NOWRAP><FONT SIZE="-1"> 605 <CODE><F,T> <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><T></CODE></FONT></TD> 606 </TR> 607 </TABLE> 608 </CODE></FONT></TD> 609 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#transform(java.lang.Iterable, com.google.common.base.Function)">transform</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><F> fromIterable, 610 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super F,? extends T> function)</CODE> 611 612 <BR> 613 Returns an iterable that applies <code>function</code> to each element of <code>fromIterable</code>.</TD> 614 </TR> 615 <TR BGCOLOR="white" CLASS="TableRowColor"> 616 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 617 <CODE>static 618 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> 619 <TR ALIGN="right" VALIGN=""> 620 <TD NOWRAP><FONT SIZE="-1"> 621 <CODE><T> <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><T></CODE></FONT></TD> 622 </TR> 623 </TABLE> 624 </CODE></FONT></TD> 625 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#unmodifiableIterable(java.lang.Iterable)">unmodifiableIterable</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><T> iterable)</CODE> 626 627 <BR> 628 Returns an unmodifiable view of <code>iterable</code>.</TD> 629 </TR> 630 </TABLE> 631 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 632 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 633 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 634 <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> 635 </TR> 636 <TR BGCOLOR="white" CLASS="TableRowColor"> 637 <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> 638 </TR> 639 </TABLE> 640 641 <P> 642 643 <!-- ============ METHOD DETAIL ========== --> 644 645 <A NAME="method_detail"><!-- --></A> 646 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 647 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 648 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 649 <B>Method Detail</B></FONT></TH> 650 </TR> 651 </TABLE> 652 653 <A NAME="unmodifiableIterable(java.lang.Iterable)"><!-- --></A><H3> 654 unmodifiableIterable</H3> 655 <PRE> 656 public static <T> <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><T> <B>unmodifiableIterable</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><T> iterable)</PRE> 657 <DL> 658 <DD>Returns an unmodifiable view of <code>iterable</code>. 659 <P> 660 <DD><DL> 661 </DL> 662 </DD> 663 </DL> 664 <HR> 665 666 <A NAME="size(java.lang.Iterable)"><!-- --></A><H3> 667 size</H3> 668 <PRE> 669 public static int <B>size</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><?> iterable)</PRE> 670 <DL> 671 <DD>Returns the number of elements in <code>iterable</code>. 672 <P> 673 <DD><DL> 674 </DL> 675 </DD> 676 </DL> 677 <HR> 678 679 <A NAME="contains(java.lang.Iterable, java.lang.Object)"><!-- --></A><H3> 680 contains</H3> 681 <PRE> 682 public static boolean <B>contains</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><?> iterable, 683 <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> 684 <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> element)</PRE> 685 <DL> 686 <DD>Returns <code>true</code> if <code>iterable</code> contains <code>element</code>; that is, 687 any object for while <code>equals(element)</code> is true. 688 <P> 689 <DD><DL> 690 </DL> 691 </DD> 692 </DL> 693 <HR> 694 695 <A NAME="removeAll(java.lang.Iterable, java.util.Collection)"><!-- --></A><H3> 696 removeAll</H3> 697 <PRE> 698 public static boolean <B>removeAll</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><?> removeFrom, 699 <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><?> elementsToRemove)</PRE> 700 <DL> 701 <DD>Removes, from an iterable, every element that belongs to the provided 702 collection. 703 704 <p>This method calls <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true#removeAll(java.util.Collection)" title="class or interface in java.util"><CODE>Collection.removeAll(java.util.Collection<?>)</CODE></A> if <code>iterable</code> is a 705 collection, and <A HREF="../../../../com/google/common/collect/Iterators.html#removeAll(java.util.Iterator, java.util.Collection)"><CODE>Iterators.removeAll(java.util.Iterator<?>, java.util.Collection<?>)</CODE></A> otherwise. 706 <P> 707 <DD><DL> 708 <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterable to (potentially) remove elements from<DD><CODE>elementsToRemove</CODE> - the elements to remove 709 <DT><B>Returns:</B><DD><code>true</code> if any elements are removed from <code>iterable</code></DL> 710 </DD> 711 </DL> 712 <HR> 713 714 <A NAME="retainAll(java.lang.Iterable, java.util.Collection)"><!-- --></A><H3> 715 retainAll</H3> 716 <PRE> 717 public static boolean <B>retainAll</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><?> removeFrom, 718 <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><?> elementsToRetain)</PRE> 719 <DL> 720 <DD>Removes, from an iterable, every element that does not belong to the 721 provided collection. 722 723 <p>This method calls <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true#retainAll(java.util.Collection)" title="class or interface in java.util"><CODE>Collection.retainAll(java.util.Collection<?>)</CODE></A> if <code>iterable</code> is a 724 collection, and <A HREF="../../../../com/google/common/collect/Iterators.html#retainAll(java.util.Iterator, java.util.Collection)"><CODE>Iterators.retainAll(java.util.Iterator<?>, java.util.Collection<?>)</CODE></A> otherwise. 725 <P> 726 <DD><DL> 727 <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterable to (potentially) remove elements from<DD><CODE>elementsToRetain</CODE> - the elements to retain 728 <DT><B>Returns:</B><DD><code>true</code> if any elements are removed from <code>iterable</code></DL> 729 </DD> 730 </DL> 731 <HR> 732 733 <A NAME="removeIf(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> 734 removeIf</H3> 735 <PRE> 736 public static <T> boolean <B>removeIf</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><T> removeFrom, 737 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> 738 <DL> 739 <DD>Removes, from an iterable, every element that satisfies the provided 740 predicate. 741 <P> 742 <DD><DL> 743 <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterable to (potentially) remove elements from<DD><CODE>predicate</CODE> - a predicate that determines whether an element should 744 be removed 745 <DT><B>Returns:</B><DD><code>true</code> if any elements were removed from the iterable 746 <DT><B>Throws:</B> 747 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if the iterable does not support 748 <code>remove()</code>.<DT><B>Since:</B></DT> 749 <DD>2010.01.04 <b>tentative</b></DD> 750 </DL> 751 </DD> 752 </DL> 753 <HR> 754 755 <A NAME="elementsEqual(java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> 756 elementsEqual</H3> 757 <PRE> 758 public static boolean <B>elementsEqual</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><?> iterable1, 759 <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><?> iterable2)</PRE> 760 <DL> 761 <DD>Determines whether two iterables contain equal elements in the same order. 762 More specifically, this method returns <code>true</code> if <code>iterable1</code> 763 and <code>iterable2</code> contain the same number of elements and every element 764 of <code>iterable1</code> is equal to the corresponding element of 765 <code>iterable2</code>. 766 <P> 767 <DD><DL> 768 </DL> 769 </DD> 770 </DL> 771 <HR> 772 773 <A NAME="toString(java.lang.Iterable)"><!-- --></A><H3> 774 toString</H3> 775 <PRE> 776 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</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><?> iterable)</PRE> 777 <DL> 778 <DD>Returns a string representation of <code>iterable</code>, with the format 779 <code>[e1, e2, ..., en]</code>. 780 <P> 781 <DD><DL> 782 </DL> 783 </DD> 784 </DL> 785 <HR> 786 787 <A NAME="getOnlyElement(java.lang.Iterable)"><!-- --></A><H3> 788 getOnlyElement</H3> 789 <PRE> 790 public static <T> T <B>getOnlyElement</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><T> iterable)</PRE> 791 <DL> 792 <DD>Returns the single element contained in <code>iterable</code>. 793 <P> 794 <DD><DL> 795 796 <DT><B>Throws:</B> 797 <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 the iterable is empty 798 <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 the iterable contains multiple 799 elements</DL> 800 </DD> 801 </DL> 802 <HR> 803 804 <A NAME="getOnlyElement(java.lang.Iterable,java.lang.Object)"><!-- --></A><A NAME="getOnlyElement(java.lang.Iterable, T)"><!-- --></A><H3> 805 getOnlyElement</H3> 806 <PRE> 807 public static <T> T <B>getOnlyElement</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><T> iterable, 808 <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> 809 T defaultValue)</PRE> 810 <DL> 811 <DD>Returns the single element contained in <code>iterable</code>, or <code>defaultValue</code> if the iterable is empty. 812 <P> 813 <DD><DL> 814 815 <DT><B>Throws:</B> 816 <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 the iterator contains multiple 817 elements</DL> 818 </DD> 819 </DL> 820 <HR> 821 822 <A NAME="toArray(java.lang.Iterable, java.lang.Class)"><!-- --></A><H3> 823 toArray</H3> 824 <PRE> 825 public static <T> T[] <B>toArray</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 T> iterable, 826 <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><T> type)</PRE> 827 <DL> 828 <DD>Copies an iterable's elements into an array. 829 <P> 830 <DD><DL> 831 <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable to copy<DD><CODE>type</CODE> - the type of the elements 832 <DT><B>Returns:</B><DD>a newly-allocated array into which all the elements of the iterable 833 have been copied</DL> 834 </DD> 835 </DL> 836 <HR> 837 838 <A NAME="addAll(java.util.Collection, java.lang.Iterable)"><!-- --></A><H3> 839 addAll</H3> 840 <PRE> 841 public static <T> boolean <B>addAll</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><T> addTo, 842 <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 T> elementsToAdd)</PRE> 843 <DL> 844 <DD>Adds all elements in <code>iterable</code> to <code>collection</code>. 845 <P> 846 <DD><DL> 847 848 <DT><B>Returns:</B><DD><code>true</code> if <code>collection</code> was modified as a result of this 849 operation.</DL> 850 </DD> 851 </DL> 852 <HR> 853 854 <A NAME="frequency(java.lang.Iterable, java.lang.Object)"><!-- --></A><H3> 855 frequency</H3> 856 <PRE> 857 public static int <B>frequency</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><?> iterable, 858 <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> 859 <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> element)</PRE> 860 <DL> 861 <DD>Returns the number of elements in the specified iterable that equal the 862 specified object. 863 <P> 864 <DD><DL> 865 <DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#frequency(java.util.Collection, java.lang.Object)" title="class or interface in java.util"><CODE>Collections.frequency(java.util.Collection<?>, java.lang.Object)</CODE></A></DL> 866 </DD> 867 </DL> 868 <HR> 869 870 <A NAME="cycle(java.lang.Iterable)"><!-- --></A><H3> 871 cycle</H3> 872 <PRE> 873 public static <T> <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><T> <B>cycle</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><T> iterable)</PRE> 874 <DL> 875 <DD>Returns an iterable whose iterators cycle indefinitely over the elements of 876 <code>iterable</code>. 877 878 <p>That iterator supports <code>remove()</code> if <code>iterable.iterator()</code> 879 does. After <code>remove()</code> is called, subsequent cycles omit the removed 880 element, which is no longer in <code>iterable</code>. The iterator's 881 <code>hasNext()</code> method returns <code>true</code> until <code>iterable</code> is 882 empty. 883 884 <p><b>Warning:</b> Typical uses of the resulting iterator may produce an 885 infinite loop. You should use an explicit <code>break</code> or be certain that 886 you will eventually remove all the elements. 887 888 <p>To cycle over the iterable <code>n</code> times, use the following: 889 <code>Iterables.concat(Collections.nCopies(n, iterable))</code> 890 <P> 891 <DD><DL> 892 </DL> 893 </DD> 894 </DL> 895 <HR> 896 897 <A NAME="cycle(java.lang.Object[])"><!-- --></A><A NAME="cycle(T...)"><!-- --></A><H3> 898 cycle</H3> 899 <PRE> 900 public static <T> <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><T> <B>cycle</B>(T... elements)</PRE> 901 <DL> 902 <DD>Returns an iterable whose iterators cycle indefinitely over the provided 903 elements. 904 905 <p>After <code>remove</code> is invoked on a generated iterator, the removed 906 element will no longer appear in either that iterator or any other iterator 907 created from the same source iterable. That is, this method behaves exactly 908 as <code>Iterables.cycle(Lists.newArrayList(elements))</code>. The iterator's 909 <code>hasNext</code> method returns <code>true</code> until all of the original 910 elements have been removed. 911 912 <p><b>Warning:</b> Typical uses of the resulting iterator may produce an 913 infinite loop. You should use an explicit <code>break</code> or be certain that 914 you will eventually remove all the elements. 915 916 <p>To cycle over the elements <code>n</code> times, use the following: 917 <code>Iterables.concat(Collections.nCopies(n, Arrays.asList(elements)))</code> 918 <P> 919 <DD><DL> 920 </DL> 921 </DD> 922 </DL> 923 <HR> 924 925 <A NAME="concat(java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> 926 concat</H3> 927 <PRE> 928 public static <T> <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><T> <B>concat</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 T> a, 929 <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 T> b)</PRE> 930 <DL> 931 <DD>Combines two iterables into a single iterable. The returned iterable has an 932 iterator that traverses the elements in <code>a</code>, followed by the elements 933 in <code>b</code>. The source iterators are not polled until necessary. 934 935 <p>The returned iterable's iterator supports <code>remove()</code> when the 936 corresponding input iterator supports it. 937 <P> 938 <DD><DL> 939 </DL> 940 </DD> 941 </DL> 942 <HR> 943 944 <A NAME="concat(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> 945 concat</H3> 946 <PRE> 947 public static <T> <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><T> <B>concat</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 T> a, 948 <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 T> b, 949 <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 T> c)</PRE> 950 <DL> 951 <DD>Combines three iterables into a single iterable. The returned iterable has 952 an iterator that traverses the elements in <code>a</code>, followed by the 953 elements in <code>b</code>, followed by the elements in <code>c</code>. The source 954 iterators are not polled until necessary. 955 956 <p>The returned iterable's iterator supports <code>remove()</code> when the 957 corresponding input iterator supports it. 958 <P> 959 <DD><DL> 960 </DL> 961 </DD> 962 </DL> 963 <HR> 964 965 <A NAME="concat(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> 966 concat</H3> 967 <PRE> 968 public static <T> <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><T> <B>concat</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 T> a, 969 <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 T> b, 970 <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 T> c, 971 <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 T> d)</PRE> 972 <DL> 973 <DD>Combines four iterables into a single iterable. The returned iterable has 974 an iterator that traverses the elements in <code>a</code>, followed by the 975 elements in <code>b</code>, followed by the elements in <code>c</code>, followed by 976 the elements in <code>d</code>. The source iterators are not polled until 977 necessary. 978 979 <p>The returned iterable's iterator supports <code>remove()</code> when the 980 corresponding input iterator supports it. 981 <P> 982 <DD><DL> 983 </DL> 984 </DD> 985 </DL> 986 <HR> 987 988 <A NAME="concat(java.lang.Iterable...)"><!-- --></A><H3> 989 concat</H3> 990 <PRE> 991 public static <T> <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><T> <B>concat</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 T>... inputs)</PRE> 992 <DL> 993 <DD>Combines multiple iterables into a single iterable. The returned iterable 994 has an iterator that traverses the elements of each iterable in 995 <code>inputs</code>. The input iterators are not polled until necessary. 996 997 <p>The returned iterable's iterator supports <code>remove()</code> when the 998 corresponding input iterator supports it. 999 <P> 1000 <DD><DL> 1001 1002 <DT><B>Throws:</B> 1003 <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 iterables is null</DL> 1004 </DD> 1005 </DL> 1006 <HR> 1007 1008 <A NAME="concat(java.lang.Iterable)"><!-- --></A><H3> 1009 concat</H3> 1010 <PRE> 1011 public static <T> <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><T> <B>concat</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/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends T>> inputs)</PRE> 1012 <DL> 1013 <DD>Combines multiple iterables into a single iterable. The returned iterable 1014 has an iterator that traverses the elements of each iterable in 1015 <code>inputs</code>. The input iterators are not polled until necessary. 1016 1017 <p>The returned iterable's iterator supports <code>remove()</code> when the 1018 corresponding input iterator supports it. The methods of the returned 1019 iterable may throw <code>NullPointerException</code> if any of the input 1020 iterators are null. 1021 <P> 1022 <DD><DL> 1023 </DL> 1024 </DD> 1025 </DL> 1026 <HR> 1027 1028 <A NAME="partition(java.lang.Iterable, int)"><!-- --></A><H3> 1029 partition</H3> 1030 <PRE> 1031 public static <T> <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><<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>> <B>partition</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><T> iterable, 1032 int size)</PRE> 1033 <DL> 1034 <DD>Divides an iterable into unmodifiable sublists of the given size (the final 1035 iterable may be smaller). For example, partitioning an iterable containing 1036 <code>[a, b, c, d, e]</code> with a partition size of 3 yields <code>[[a, b, c], [d, e]]</code> -- an outer iterable containing two inner lists of 1037 three and two elements, all in the original order. 1038 1039 <p>Iterators returned by the returned iterable do not support the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true#remove()" title="class or interface in java.util"><CODE>Iterator.remove()</CODE></A> method. The returned lists implement <A HREF="http://java.sun.com/javase/6/docs/api/java/util/RandomAccess.html?is-external=true" title="class or interface in java.util"><CODE>RandomAccess</CODE></A>, whether or not the input list does. 1040 1041 <p><b>Note:</b> if <code>iterable</code> is 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"><CODE>List</CODE></A>, use <A HREF="../../../../com/google/common/collect/Lists.html#partition(java.util.List, int)"><CODE>Lists.partition(List, int)</CODE></A> instead. 1042 <P> 1043 <DD><DL> 1044 <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable to return a partitioned view of<DD><CODE>size</CODE> - the desired size of each partition (the last may be smaller) 1045 <DT><B>Returns:</B><DD>an iterable of unmodifiable lists containing the elements of <code>iterable</code> divided into partitions 1046 <DT><B>Throws:</B> 1047 <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>size</code> is nonpositive</DL> 1048 </DD> 1049 </DL> 1050 <HR> 1051 1052 <A NAME="paddedPartition(java.lang.Iterable, int)"><!-- --></A><H3> 1053 paddedPartition</H3> 1054 <PRE> 1055 public static <T> <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><<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>> <B>paddedPartition</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><T> iterable, 1056 int size)</PRE> 1057 <DL> 1058 <DD>Divides an iterable into unmodifiable sublists of the given size, padding 1059 the final iterable with null values if necessary. For example, partitioning 1060 an iterable containing <code>[a, b, c, d, e]</code> with a partition size of 3 1061 yields <code>[[a, b, c], [d, e, null]]</code> -- an outer iterable containing 1062 two inner lists of three elements each, all in the original order. 1063 1064 <p>Iterators returned by the returned iterable do not support the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true#remove()" title="class or interface in java.util"><CODE>Iterator.remove()</CODE></A> method. 1065 <P> 1066 <DD><DL> 1067 <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable to return a partitioned view of<DD><CODE>size</CODE> - the desired size of each partition 1068 <DT><B>Returns:</B><DD>an iterable of unmodifiable lists containing the elements of <code>iterable</code> divided into partitions (the final iterable may have 1069 trailing null elements) 1070 <DT><B>Throws:</B> 1071 <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>size</code> is nonpositive</DL> 1072 </DD> 1073 </DL> 1074 <HR> 1075 1076 <A NAME="filter(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> 1077 filter</H3> 1078 <PRE> 1079 public static <T> <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><T> <B>filter</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><T> unfiltered, 1080 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> 1081 <DL> 1082 <DD>Returns the elements of <code>unfiltered</code> that satisfy a predicate. The 1083 resulting iterable's iterator does not support <code>remove()</code>. 1084 <P> 1085 <DD><DL> 1086 </DL> 1087 </DD> 1088 </DL> 1089 <HR> 1090 1091 <A NAME="filter(java.lang.Iterable, java.lang.Class)"><!-- --></A><H3> 1092 filter</H3> 1093 <PRE> 1094 public static <T> <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><T> <B>filter</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><?> unfiltered, 1095 <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><T> type)</PRE> 1096 <DL> 1097 <DD>Returns all instances of class <code>type</code> in <code>unfiltered</code>. The 1098 returned iterable has elements whose class is <code>type</code> or a subclass of 1099 <code>type</code>. The returned iterable's iterator does not support 1100 <code>remove()</code>. 1101 <P> 1102 <DD><DL> 1103 <DT><B>Parameters:</B><DD><CODE>unfiltered</CODE> - an iterable containing objects of any type<DD><CODE>type</CODE> - the type of elements desired 1104 <DT><B>Returns:</B><DD>an unmodifiable iterable containing all elements of the original 1105 iterable that were of the requested type</DL> 1106 </DD> 1107 </DL> 1108 <HR> 1109 1110 <A NAME="any(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> 1111 any</H3> 1112 <PRE> 1113 public static <T> boolean <B>any</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><T> iterable, 1114 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> 1115 <DL> 1116 <DD>Returns <code>true</code> if one or more elements in <code>iterable</code> satisfy 1117 the predicate. 1118 <P> 1119 <DD><DL> 1120 </DL> 1121 </DD> 1122 </DL> 1123 <HR> 1124 1125 <A NAME="all(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> 1126 all</H3> 1127 <PRE> 1128 public static <T> boolean <B>all</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><T> iterable, 1129 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> 1130 <DL> 1131 <DD>Returns <code>true</code> if every element in <code>iterable</code> satisfies the 1132 predicate. If <code>iterable</code> is empty, <code>true</code> is returned. 1133 <P> 1134 <DD><DL> 1135 </DL> 1136 </DD> 1137 </DL> 1138 <HR> 1139 1140 <A NAME="find(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> 1141 find</H3> 1142 <PRE> 1143 public static <T> T <B>find</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><T> iterable, 1144 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> 1145 <DL> 1146 <DD>Returns the first element in <code>iterable</code> that satisfies the given 1147 predicate. 1148 <P> 1149 <DD><DL> 1150 1151 <DT><B>Throws:</B> 1152 <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 no element in <code>iterable</code> matches 1153 the given predicate</DL> 1154 </DD> 1155 </DL> 1156 <HR> 1157 1158 <A NAME="indexOf(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> 1159 indexOf</H3> 1160 <PRE> 1161 public static <T> int <B>indexOf</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><T> iterable, 1162 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> 1163 <DL> 1164 <DD>Returns the index in <code>iterable</code> of the first element that satisfies 1165 the provided <code>predicate</code>, or <code>-1</code> if the Iterable has no such 1166 elements. 1167 1168 <p>More formally, returns the lowest index <code>i</code> such that 1169 <code>predicate.apply(Iterables.get(iterable, i))</code> is <code>true</code> or 1170 <code>-1</code> if there is no such index. 1171 <P> 1172 <DD><DL> 1173 <DT><B>Since:</B></DT> 1174 <DD>2010.01.04 <b>tentative</b></DD> 1175 </DL> 1176 </DD> 1177 </DL> 1178 <HR> 1179 1180 <A NAME="transform(java.lang.Iterable, com.google.common.base.Function)"><!-- --></A><H3> 1181 transform</H3> 1182 <PRE> 1183 public static <F,T> <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><T> <B>transform</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><F> fromIterable, 1184 <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super F,? extends T> function)</PRE> 1185 <DL> 1186 <DD>Returns an iterable that applies <code>function</code> to each element of <code>fromIterable</code>. 1187 1188 <p>The returned iterable's iterator supports <code>remove()</code> if the 1189 provided iterator does. After a successful <code>remove()</code> call, 1190 <code>fromIterable</code> no longer contains the corresponding element. 1191 <P> 1192 <DD><DL> 1193 </DL> 1194 </DD> 1195 </DL> 1196 <HR> 1197 1198 <A NAME="get(java.lang.Iterable, int)"><!-- --></A><H3> 1199 get</H3> 1200 <PRE> 1201 public static <T> T <B>get</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><T> iterable, 1202 int position)</PRE> 1203 <DL> 1204 <DD>Returns the element at the specified position in an iterable. 1205 <P> 1206 <DD><DL> 1207 <DT><B>Parameters:</B><DD><CODE>position</CODE> - position of the element to return 1208 <DT><B>Returns:</B><DD>the element at the specified position in <code>iterable</code> 1209 <DT><B>Throws:</B> 1210 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>position</code> is negative or 1211 greater than or equal to the size of <code>iterable</code></DL> 1212 </DD> 1213 </DL> 1214 <HR> 1215 1216 <A NAME="getLast(java.lang.Iterable)"><!-- --></A><H3> 1217 getLast</H3> 1218 <PRE> 1219 public static <T> T <B>getLast</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><T> iterable)</PRE> 1220 <DL> 1221 <DD>Returns the last element of <code>iterable</code>. 1222 <P> 1223 <DD><DL> 1224 1225 <DT><B>Returns:</B><DD>the last element of <code>iterable</code> 1226 <DT><B>Throws:</B> 1227 <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 the iterable has no elements</DL> 1228 </DD> 1229 </DL> 1230 <HR> 1231 1232 <A NAME="consumingIterable(java.lang.Iterable)"><!-- --></A><H3> 1233 consumingIterable</H3> 1234 <PRE> 1235 public static <T> <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><T> <B>consumingIterable</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><T> iterable)</PRE> 1236 <DL> 1237 <DD>Returns a view of the supplied iterable that wraps each generated 1238 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util"><CODE>Iterator</CODE></A> through <A HREF="../../../../com/google/common/collect/Iterators.html#consumingIterator(java.util.Iterator)"><CODE>Iterators.consumingIterator(Iterator)</CODE></A>. 1239 <P> 1240 <DD><DL> 1241 <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable to wrap 1242 <DT><B>Returns:</B><DD>a view of the supplied iterable that wraps each generated iterator 1243 through <A HREF="../../../../com/google/common/collect/Iterators.html#consumingIterator(java.util.Iterator)"><CODE>Iterators.consumingIterator(Iterator)</CODE></A><DT><B>Since:</B></DT> 1244 <DD>2010.01.04 <b>tentative</b></DD> 1245 <DT><B>See Also:</B><DD><A HREF="../../../../com/google/common/collect/Iterators.html#consumingIterator(java.util.Iterator)"><CODE>Iterators.consumingIterator(Iterator)</CODE></A></DL> 1246 </DD> 1247 </DL> 1248 <HR> 1249 1250 <A NAME="reverse(java.util.List)"><!-- --></A><H3> 1251 reverse</H3> 1252 <PRE> 1253 public static <T> <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><T> <B>reverse</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> list)</PRE> 1254 <DL> 1255 <DD>Adapts a list to an iterable with reversed iteration order. It is 1256 especially useful in foreach-style loops: <pre class="code"> <code>List<String> mylist = ... 1257 for (String str : Iterables.reverse(mylist)) { 1258 ... 1259 }</code></pre> 1260 1261 There is no corresponding method in <A HREF="../../../../com/google/common/collect/Iterators.html" title="class in com.google.common.collect"><CODE>Iterators</CODE></A>, since <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true#iterator()" title="class or interface in java.lang"><CODE>Iterable.iterator()</CODE></A> can simply be invoked on the result of calling this 1262 method. 1263 <P> 1264 <DD><DL> 1265 1266 <DT><B>Returns:</B><DD>an iterable with the same elements as the list, in reverse</DL> 1267 </DD> 1268 </DL> 1269 <HR> 1270 1271 <A NAME="isEmpty(java.lang.Iterable)"><!-- --></A><H3> 1272 isEmpty</H3> 1273 <PRE> 1274 public static <T> boolean <B>isEmpty</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><T> iterable)</PRE> 1275 <DL> 1276 <DD>Determines if the given iterable contains no elements. 1277 1278 <p>There is no precise <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util"><CODE>Iterator</CODE></A> equivalent to this method, since 1279 one can only ask an iterator whether it has any elements <i>remaining</i> 1280 (which one does using <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true#hasNext()" title="class or interface in java.util"><CODE>Iterator.hasNext()</CODE></A>). 1281 <P> 1282 <DD><DL> 1283 1284 <DT><B>Returns:</B><DD><code>true</code> if the iterable contains no elements</DL> 1285 </DD> 1286 </DL> 1287 <!-- ========= END OF CLASS DATA ========= --> 1288 <HR> 1289 1290 1291 <!-- ======= START OF BOTTOM NAVBAR ====== --> 1292 <A NAME="navbar_bottom"><!-- --></A> 1293 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 1294 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 1295 <TR> 1296 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 1297 <A NAME="navbar_bottom_firstrow"><!-- --></A> 1298 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 1299 <TR ALIGN="center" VALIGN="top"> 1300 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 1301 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 1302 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 1303 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Iterables.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 1304 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 1305 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 1306 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 1307 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 1308 </TR> 1309 </TABLE> 1310 </TD> 1311 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 1312 </EM> 1313 </TD> 1314 </TR> 1315 1316 <TR> 1317 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1318 <A HREF="../../../../com/google/common/collect/ImmutableSortedSet.Builder.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> 1319 <A HREF="../../../../com/google/common/collect/Iterators.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> 1320 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1321 <A HREF="../../../../index.html?com/google/common/collect/Iterables.html" target="_top"><B>FRAMES</B></A> 1322 <A HREF="Iterables.html" target="_top"><B>NO FRAMES</B></A> 1323 <SCRIPT type="text/javascript"> 1324 <!-- 1325 if(window==top) { 1326 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 1327 } 1328 //--> 1329 </SCRIPT> 1330 <NOSCRIPT> 1331 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 1332 </NOSCRIPT> 1333 1334 1335 </FONT></TD> 1336 </TR> 1337 <TR> 1338 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1339 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 1340 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1341 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 1342 </TR> 1343 </TABLE> 1344 <A NAME="skip-navbar_bottom"></A> 1345 <!-- ======== END OF BOTTOM NAVBAR ======= --> 1346 1347 <HR> 1348 1349 </BODY> 1350 </HTML> 1351