<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 --> <TITLE> Iterables (Guava Libraries 2010.01.04) </TITLE> <META NAME="date" CONTENT="2010-01-04"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Iterables (Guava Libraries 2010.01.04)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Iterables.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/google/common/collect/ImmutableSortedSet.Builder.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> <A HREF="../../../../com/google/common/collect/Iterators.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/google/common/collect/Iterables.html" target="_top"><B>FRAMES</B></A> <A HREF="Iterables.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.google.common.collect</FONT> <BR> Class Iterables</H2> <PRE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.collect.Iterables</B> </PRE> <HR> <DL> <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> </PRE> <P> This class contains static utility methods that operate on or return objects of type <code>Iterable</code>. Except as noted, each method has a corresponding <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. <P> <P> <DL> <DT><B>Since:</B></DT> <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD> <DT><B>Author:</B></DT> <DD>Kevin Bourrillion, Jared Levy</DD> </DL> <HR> <P> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> boolean</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <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> <BR> Adds all elements in <code>iterable</code> to <code>collection</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> boolean</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> <BR> Returns <code>true</code> if every element in <code>iterable</code> satisfies the predicate.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> boolean</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> <BR> Returns <code>true</code> if one or more elements in <code>iterable</code> satisfy the predicate.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Combines multiple iterables into a single iterable.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Combines multiple iterables into a single iterable.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, <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> <BR> Combines two iterables into a single iterable.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, <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, <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> <BR> Combines three iterables into a single iterable.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, <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, <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, <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> <BR> Combines four iterables into a single iterable.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Returns a view of the supplied iterable that wraps each generated <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> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static boolean</CODE></FONT></TD> <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, <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> <BR> Returns <code>true</code> if <code>iterable</code> contains <code>element</code>; that is, any object for while <code>equals(element)</code> is true.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Returns an iterable whose iterators cycle indefinitely over the elements of <code>iterable</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterables.html#cycle(T...)">cycle</A></B>(T... elements)</CODE> <BR> Returns an iterable whose iterators cycle indefinitely over the provided elements.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static boolean</CODE></FONT></TD> <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, <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> <BR> Determines whether two iterables contain equal elements in the same order.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, <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> <BR> Returns all instances of class <code>type</code> in <code>unfiltered</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> <BR> Returns the elements of <code>unfiltered</code> that satisfy a predicate.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> <BR> Returns the first element in <code>iterable</code> that satisfies the given predicate.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD> <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, <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> <BR> Returns the number of elements in the specified iterable that equal the specified object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, int position)</CODE> <BR> Returns the element at the specified position in an iterable.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Returns the last element of <code>iterable</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Returns the single element contained in <code>iterable</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, T defaultValue)</CODE> <BR> Returns the single element contained in <code>iterable</code>, or <code>defaultValue</code> if the iterable is empty.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> int</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> <BR> Returns the index in <code>iterable</code> of the first element that satisfies the provided <code>predicate</code>, or <code>-1</code> if the Iterable has no such elements.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> boolean</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Determines if the given iterable contains no elements.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, int size)</CODE> <BR> Divides an iterable into unmodifiable sublists of the given size, padding the final iterable with null values if necessary.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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, int size)</CODE> <BR> Divides an iterable into unmodifiable sublists of the given size (the final iterable may be smaller).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static boolean</CODE></FONT></TD> <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, <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> <BR> Removes, from an iterable, every element that belongs to the provided collection.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> boolean</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</CODE> <BR> Removes, from an iterable, every element that satisfies the provided predicate.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static boolean</CODE></FONT></TD> <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, <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> <BR> Removes, from an iterable, every element that does not belong to the provided collection.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Adapts a list to an iterable with reversed iteration order.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD> <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> <BR> Returns the number of elements in <code>iterable</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T[]</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <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, <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> <BR> Copies an iterable's elements into an array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <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> <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> <BR> Returns a string representation of <code>iterable</code>, with the format <code>[e1, e2, ..., en]</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><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> </TR> </TABLE> </CODE></FONT></TD> <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, <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super F,? extends T> function)</CODE> <BR> Returns an iterable that applies <code>function</code> to each element of <code>fromIterable</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="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> </TR> </TABLE> </CODE></FONT></TD> <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> <BR> Returns an unmodifiable view of <code>iterable</code>.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> </TR> </TABLE> <P> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="unmodifiableIterable(java.lang.Iterable)"><!-- --></A><H3> unmodifiableIterable</H3> <PRE> 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> <DL> <DD>Returns an unmodifiable view of <code>iterable</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="size(java.lang.Iterable)"><!-- --></A><H3> size</H3> <PRE> 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> <DL> <DD>Returns the number of elements in <code>iterable</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="contains(java.lang.Iterable, java.lang.Object)"><!-- --></A><H3> contains</H3> <PRE> 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, <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> <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> <DL> <DD>Returns <code>true</code> if <code>iterable</code> contains <code>element</code>; that is, any object for while <code>equals(element)</code> is true. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="removeAll(java.lang.Iterable, java.util.Collection)"><!-- --></A><H3> removeAll</H3> <PRE> 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, <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> <DL> <DD>Removes, from an iterable, every element that belongs to the provided collection. <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 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. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterable to (potentially) remove elements from<DD><CODE>elementsToRemove</CODE> - the elements to remove <DT><B>Returns:</B><DD><code>true</code> if any elements are removed from <code>iterable</code></DL> </DD> </DL> <HR> <A NAME="retainAll(java.lang.Iterable, java.util.Collection)"><!-- --></A><H3> retainAll</H3> <PRE> 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, <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> <DL> <DD>Removes, from an iterable, every element that does not belong to the provided collection. <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 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. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterable to (potentially) remove elements from<DD><CODE>elementsToRetain</CODE> - the elements to retain <DT><B>Returns:</B><DD><code>true</code> if any elements are removed from <code>iterable</code></DL> </DD> </DL> <HR> <A NAME="removeIf(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> removeIf</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> <DL> <DD>Removes, from an iterable, every element that satisfies the provided predicate. <P> <DD><DL> <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 be removed <DT><B>Returns:</B><DD><code>true</code> if any elements were removed from the iterable <DT><B>Throws:</B> <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 <code>remove()</code>.<DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> </DL> </DD> </DL> <HR> <A NAME="elementsEqual(java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> elementsEqual</H3> <PRE> 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, <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> <DL> <DD>Determines whether two iterables contain equal elements in the same order. More specifically, this method returns <code>true</code> if <code>iterable1</code> and <code>iterable2</code> contain the same number of elements and every element of <code>iterable1</code> is equal to the corresponding element of <code>iterable2</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="toString(java.lang.Iterable)"><!-- --></A><H3> toString</H3> <PRE> 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> <DL> <DD>Returns a string representation of <code>iterable</code>, with the format <code>[e1, e2, ..., en]</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getOnlyElement(java.lang.Iterable)"><!-- --></A><H3> getOnlyElement</H3> <PRE> 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> <DL> <DD>Returns the single element contained in <code>iterable</code>. <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util">NoSuchElementException</A></CODE> - if the iterable is empty <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 elements</DL> </DD> </DL> <HR> <A NAME="getOnlyElement(java.lang.Iterable,java.lang.Object)"><!-- --></A><A NAME="getOnlyElement(java.lang.Iterable, T)"><!-- --></A><H3> getOnlyElement</H3> <PRE> 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, <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> T defaultValue)</PRE> <DL> <DD>Returns the single element contained in <code>iterable</code>, or <code>defaultValue</code> if the iterable is empty. <P> <DD><DL> <DT><B>Throws:</B> <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 elements</DL> </DD> </DL> <HR> <A NAME="toArray(java.lang.Iterable, java.lang.Class)"><!-- --></A><H3> toArray</H3> <PRE> 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, <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> <DL> <DD>Copies an iterable's elements into an array. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable to copy<DD><CODE>type</CODE> - the type of the elements <DT><B>Returns:</B><DD>a newly-allocated array into which all the elements of the iterable have been copied</DL> </DD> </DL> <HR> <A NAME="addAll(java.util.Collection, java.lang.Iterable)"><!-- --></A><H3> addAll</H3> <PRE> 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, <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> <DL> <DD>Adds all elements in <code>iterable</code> to <code>collection</code>. <P> <DD><DL> <DT><B>Returns:</B><DD><code>true</code> if <code>collection</code> was modified as a result of this operation.</DL> </DD> </DL> <HR> <A NAME="frequency(java.lang.Iterable, java.lang.Object)"><!-- --></A><H3> frequency</H3> <PRE> 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, <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> <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> <DL> <DD>Returns the number of elements in the specified iterable that equal the specified object. <P> <DD><DL> <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> </DD> </DL> <HR> <A NAME="cycle(java.lang.Iterable)"><!-- --></A><H3> cycle</H3> <PRE> 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> <DL> <DD>Returns an iterable whose iterators cycle indefinitely over the elements of <code>iterable</code>. <p>That iterator supports <code>remove()</code> if <code>iterable.iterator()</code> does. After <code>remove()</code> is called, subsequent cycles omit the removed element, which is no longer in <code>iterable</code>. The iterator's <code>hasNext()</code> method returns <code>true</code> until <code>iterable</code> is empty. <p><b>Warning:</b> Typical uses of the resulting iterator may produce an infinite loop. You should use an explicit <code>break</code> or be certain that you will eventually remove all the elements. <p>To cycle over the iterable <code>n</code> times, use the following: <code>Iterables.concat(Collections.nCopies(n, iterable))</code> <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="cycle(java.lang.Object[])"><!-- --></A><A NAME="cycle(T...)"><!-- --></A><H3> cycle</H3> <PRE> 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> <DL> <DD>Returns an iterable whose iterators cycle indefinitely over the provided elements. <p>After <code>remove</code> is invoked on a generated iterator, the removed element will no longer appear in either that iterator or any other iterator created from the same source iterable. That is, this method behaves exactly as <code>Iterables.cycle(Lists.newArrayList(elements))</code>. The iterator's <code>hasNext</code> method returns <code>true</code> until all of the original elements have been removed. <p><b>Warning:</b> Typical uses of the resulting iterator may produce an infinite loop. You should use an explicit <code>break</code> or be certain that you will eventually remove all the elements. <p>To cycle over the elements <code>n</code> times, use the following: <code>Iterables.concat(Collections.nCopies(n, Arrays.asList(elements)))</code> <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> concat</H3> <PRE> 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, <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> <DL> <DD>Combines two iterables into a single iterable. The returned iterable has an iterator that traverses the elements in <code>a</code>, followed by the elements in <code>b</code>. The source iterators are not polled until necessary. <p>The returned iterable's iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> concat</H3> <PRE> 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, <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, <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> <DL> <DD>Combines three iterables into a single iterable. The returned iterable has an iterator that traverses the elements in <code>a</code>, followed by the elements in <code>b</code>, followed by the elements in <code>c</code>. The source iterators are not polled until necessary. <p>The returned iterable's iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.lang.Iterable, java.lang.Iterable, java.lang.Iterable, java.lang.Iterable)"><!-- --></A><H3> concat</H3> <PRE> 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, <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, <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, <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> <DL> <DD>Combines four iterables into a single iterable. The returned iterable has an iterator that traverses the elements in <code>a</code>, followed by the elements in <code>b</code>, followed by the elements in <code>c</code>, followed by the elements in <code>d</code>. The source iterators are not polled until necessary. <p>The returned iterable's iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.lang.Iterable...)"><!-- --></A><H3> concat</H3> <PRE> 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> <DL> <DD>Combines multiple iterables into a single iterable. The returned iterable has an iterator that traverses the elements of each iterable in <code>inputs</code>. The input iterators are not polled until necessary. <p>The returned iterable's iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if any of the provided iterables is null</DL> </DD> </DL> <HR> <A NAME="concat(java.lang.Iterable)"><!-- --></A><H3> concat</H3> <PRE> 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> <DL> <DD>Combines multiple iterables into a single iterable. The returned iterable has an iterator that traverses the elements of each iterable in <code>inputs</code>. The input iterators are not polled until necessary. <p>The returned iterable's iterator supports <code>remove()</code> when the corresponding input iterator supports it. The methods of the returned iterable may throw <code>NullPointerException</code> if any of the input iterators are null. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="partition(java.lang.Iterable, int)"><!-- --></A><H3> partition</H3> <PRE> 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, int size)</PRE> <DL> <DD>Divides an iterable into unmodifiable sublists of the given size (the final iterable may be smaller). For example, partitioning an iterable containing <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 three and two elements, all in the original order. <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. <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. <P> <DD><DL> <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) <DT><B>Returns:</B><DD>an iterable of unmodifiable lists containing the elements of <code>iterable</code> divided into partitions <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="paddedPartition(java.lang.Iterable, int)"><!-- --></A><H3> paddedPartition</H3> <PRE> 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, int size)</PRE> <DL> <DD>Divides an iterable into unmodifiable sublists of the given size, padding the final iterable with null values if necessary. For example, partitioning an iterable containing <code>[a, b, c, d, e]</code> with a partition size of 3 yields <code>[[a, b, c], [d, e, null]]</code> -- an outer iterable containing two inner lists of three elements each, all in the original order. <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. <P> <DD><DL> <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 <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 trailing null elements) <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="filter(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> filter</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> <DL> <DD>Returns the elements of <code>unfiltered</code> that satisfy a predicate. The resulting iterable's iterator does not support <code>remove()</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="filter(java.lang.Iterable, java.lang.Class)"><!-- --></A><H3> filter</H3> <PRE> 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, <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> <DL> <DD>Returns all instances of class <code>type</code> in <code>unfiltered</code>. The returned iterable has elements whose class is <code>type</code> or a subclass of <code>type</code>. The returned iterable's iterator does not support <code>remove()</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>unfiltered</CODE> - an iterable containing objects of any type<DD><CODE>type</CODE> - the type of elements desired <DT><B>Returns:</B><DD>an unmodifiable iterable containing all elements of the original iterable that were of the requested type</DL> </DD> </DL> <HR> <A NAME="any(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> any</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> <DL> <DD>Returns <code>true</code> if one or more elements in <code>iterable</code> satisfy the predicate. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="all(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> all</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> <DL> <DD>Returns <code>true</code> if every element in <code>iterable</code> satisfies the predicate. If <code>iterable</code> is empty, <code>true</code> is returned. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="find(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> find</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> <DL> <DD>Returns the first element in <code>iterable</code> that satisfies the given predicate. <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util">NoSuchElementException</A></CODE> - if no element in <code>iterable</code> matches the given predicate</DL> </DD> </DL> <HR> <A NAME="indexOf(java.lang.Iterable, com.google.common.base.Predicate)"><!-- --></A><H3> indexOf</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super T> predicate)</PRE> <DL> <DD>Returns the index in <code>iterable</code> of the first element that satisfies the provided <code>predicate</code>, or <code>-1</code> if the Iterable has no such elements. <p>More formally, returns the lowest index <code>i</code> such that <code>predicate.apply(Iterables.get(iterable, i))</code> is <code>true</code> or <code>-1</code> if there is no such index. <P> <DD><DL> <DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> </DL> </DD> </DL> <HR> <A NAME="transform(java.lang.Iterable, com.google.common.base.Function)"><!-- --></A><H3> transform</H3> <PRE> 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, <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A><? super F,? extends T> function)</PRE> <DL> <DD>Returns an iterable that applies <code>function</code> to each element of <code>fromIterable</code>. <p>The returned iterable's iterator supports <code>remove()</code> if the provided iterator does. After a successful <code>remove()</code> call, <code>fromIterable</code> no longer contains the corresponding element. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="get(java.lang.Iterable, int)"><!-- --></A><H3> get</H3> <PRE> 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, int position)</PRE> <DL> <DD>Returns the element at the specified position in an iterable. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>position</CODE> - position of the element to return <DT><B>Returns:</B><DD>the element at the specified position in <code>iterable</code> <DT><B>Throws:</B> <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 greater than or equal to the size of <code>iterable</code></DL> </DD> </DL> <HR> <A NAME="getLast(java.lang.Iterable)"><!-- --></A><H3> getLast</H3> <PRE> 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> <DL> <DD>Returns the last element of <code>iterable</code>. <P> <DD><DL> <DT><B>Returns:</B><DD>the last element of <code>iterable</code> <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/NoSuchElementException.html?is-external=true" title="class or interface in java.util">NoSuchElementException</A></CODE> - if the iterable has no elements</DL> </DD> </DL> <HR> <A NAME="consumingIterable(java.lang.Iterable)"><!-- --></A><H3> consumingIterable</H3> <PRE> 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> <DL> <DD>Returns a view of the supplied iterable that wraps each generated <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>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterable</CODE> - the iterable to wrap <DT><B>Returns:</B><DD>a view of the supplied iterable that wraps each generated iterator through <A HREF="../../../../com/google/common/collect/Iterators.html#consumingIterator(java.util.Iterator)"><CODE>Iterators.consumingIterator(Iterator)</CODE></A><DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> <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> </DD> </DL> <HR> <A NAME="reverse(java.util.List)"><!-- --></A><H3> reverse</H3> <PRE> 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> <DL> <DD>Adapts a list to an iterable with reversed iteration order. It is especially useful in foreach-style loops: <pre class="code"> <code>List<String> mylist = ... for (String str : Iterables.reverse(mylist)) { ... }</code></pre> 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 method. <P> <DD><DL> <DT><B>Returns:</B><DD>an iterable with the same elements as the list, in reverse</DL> </DD> </DL> <HR> <A NAME="isEmpty(java.lang.Iterable)"><!-- --></A><H3> isEmpty</H3> <PRE> 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> <DL> <DD>Determines if the given iterable contains no elements. <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 one can only ask an iterator whether it has any elements <i>remaining</i> (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>). <P> <DD><DL> <DT><B>Returns:</B><DD><code>true</code> if the iterable contains no elements</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Iterables.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/google/common/collect/ImmutableSortedSet.Builder.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> <A HREF="../../../../com/google/common/collect/Iterators.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/google/common/collect/Iterables.html" target="_top"><B>FRAMES</B></A> <A HREF="Iterables.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>