<!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> Iterators (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="Iterators (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/Iterators.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/Iterables.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> <A HREF="../../../../com/google/common/collect/LinkedHashMultimap.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/Iterators.html" target="_top"><B>FRAMES</B></A> <A HREF="Iterators.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 Iterators</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.Iterators</B> </PRE> <HR> <DL> <DT><PRE>public final class <B>Iterators</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 <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>. Except as noted, each method has a corresponding <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><CODE>Iterable</CODE></A>-based method in the <A HREF="../../../../com/google/common/collect/Iterables.html" title="class in com.google.common.collect"><CODE>Iterables</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/Iterators.html#addAll(java.util.Collection, java.util.Iterator)">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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> iterator)</CODE> <BR> Adds all elements in <code>iterator</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/Iterators.html#all(java.util.Iterator, com.google.common.base.Predicate)">all</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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 returned by <code>iterator</code> satisfies the given 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/Iterators.html#any(java.util.Iterator, com.google.common.base.Predicate)">any</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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 returned by <code>iterator</code> satisfy the given 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/util/Enumeration.html?is-external=true" title="class or interface in java.util">Enumeration</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#asEnumeration(java.util.Iterator)">asEnumeration</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</CODE> <BR> Adapts an <code>Iterator</code> to the <code>Enumeration</code> interface.</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#concat(java.util.Iterator)">concat</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T>> inputs)</CODE> <BR> Combines multiple iterators into a single iterator.</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#concat(java.util.Iterator...)">concat</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T>... inputs)</CODE> <BR> Combines multiple iterators into a single iterator.</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#concat(java.util.Iterator, java.util.Iterator)">concat</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> a, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> b)</CODE> <BR> Combines two iterators into a single iterator.</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#concat(java.util.Iterator, java.util.Iterator, java.util.Iterator)">concat</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> a, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> b, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> c)</CODE> <BR> Combines three iterators into a single iterator.</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#concat(java.util.Iterator, java.util.Iterator, java.util.Iterator, java.util.Iterator)">concat</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> a, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> b, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> c, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> d)</CODE> <BR> Combines four iterators into a single iterator.</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#consumingIterator(java.util.Iterator)">consumingIterator</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</CODE> <BR> Returns a view of the supplied <code>iterator</code> that removes each element from the supplied <code>iterator</code> as it is returned.</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/Iterators.html#contains(java.util.Iterator, java.lang.Object)">contains</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator, <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>iterator</code> contains <code>element</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.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 iterator that cycles 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#cycle(T...)">cycle</A></B>(T... elements)</CODE> <BR> Returns an iterator that cycles 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/Iterators.html#elementsEqual(java.util.Iterator, java.util.Iterator)">elementsEqual</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator1, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator2)</CODE> <BR> Determines whether two iterators 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="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#emptyIterator()">emptyIterator</A></B>()</CODE> <BR> Returns the empty iterator.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#filter(java.util.Iterator, java.lang.Class)">filter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#filter(java.util.Iterator, com.google.common.base.Predicate)">filter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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/Iterators.html#find(java.util.Iterator, com.google.common.base.Predicate)">find</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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>iterator</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 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#forArray(T...)">forArray</A></B>(T... array)</CODE> <BR> Returns an iterator containing the elements of <code>array</code> in 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="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#forEnumeration(java.util.Enumeration)">forEnumeration</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Enumeration.html?is-external=true" title="class or interface in java.util">Enumeration</A><T> enumeration)</CODE> <BR> Adapts an <code>Enumeration</code> to the <code>Iterator</code> interface.</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/Iterators.html#frequency(java.util.Iterator, java.lang.Object)">frequency</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator, <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 iterator 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/Iterators.html#get(java.util.Iterator, int)">get</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, int position)</CODE> <BR> Advances <code>iterator</code> <code>position + 1</code> times, returning the element at the <code>position</code>th position.</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/Iterators.html#getLast(java.util.Iterator)">getLast</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</CODE> <BR> Advances <code>iterator</code> to the end, returning the last element.</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/Iterators.html#getOnlyElement(java.util.Iterator)">getOnlyElement</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</CODE> <BR> Returns the single element contained in <code>iterator</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/Iterators.html#getOnlyElement(java.util.Iterator, T)">getOnlyElement</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, T defaultValue)</CODE> <BR> Returns the single element contained in <code>iterator</code>, or <code>defaultValue</code> if the iterator 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/Iterators.html#indexOf(java.util.Iterator, com.google.common.base.Predicate)">indexOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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>iterator</code> of the first element that satisfies the provided <code>predicate</code>, or <code>-1</code> if the Iterator 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> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</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/Iterators.html#paddedPartition(java.util.Iterator, int)">paddedPartition</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, int size)</CODE> <BR> Divides an iterator into unmodifiable sublists of the given size, padding the final iterator 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="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</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/Iterators.html#partition(java.util.Iterator, int)">partition</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, int size)</CODE> <BR> Divides an iterator into unmodifiable sublists of the given size (the final list may be smaller).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect">PeekingIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#peekingIterator(java.util.Iterator)">peekingIterator</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> iterator)</CODE> <BR> Returns a <code>PeekingIterator</code> backed by the given iterator.</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/Iterators.html#removeAll(java.util.Iterator, java.util.Collection)">removeAll</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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> Traverses an iterator and removes 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/Iterators.html#removeIf(java.util.Iterator, com.google.common.base.Predicate)">removeIf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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 every element that satisfies the provided predicate from the iterator.</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/Iterators.html#retainAll(java.util.Iterator, java.util.Collection)">retainAll</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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> Traverses an iterator and removes 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="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#singletonIterator(T)">singletonIterator</A></B>(T value)</CODE> <BR> Returns an iterator containing only <code>value</code>.</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/Iterators.html#size(java.util.Iterator)">size</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator)</CODE> <BR> Returns the number of elements remaining in <code>iterator</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/Iterators.html#toArray(java.util.Iterator, java.lang.Class)">toArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> iterator, <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 iterator'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/Iterators.html#toString(java.util.Iterator)">toString</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator)</CODE> <BR> Returns a string representation of <code>iterator</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#transform(java.util.Iterator, com.google.common.base.Function)">transform</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><F> fromIterator, <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 iterator that applies <code>function</code> to each element of <code>fromIterator</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T></CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#unmodifiableIterator(java.util.Iterator)">unmodifiableIterator</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</CODE> <BR> Returns an unmodifiable view of <code>iterator</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="emptyIterator()"><!-- --></A><H3> emptyIterator</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>emptyIterator</B>()</PRE> <DL> <DD>Returns the empty iterator. <p>The <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><CODE>Iterable</CODE></A> equivalent of this method is <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#emptySet()" title="class or interface in java.util"><CODE>Collections.emptySet()</CODE></A>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="unmodifiableIterator(java.util.Iterator)"><!-- --></A><H3> unmodifiableIterator</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>unmodifiableIterator</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</PRE> <DL> <DD>Returns an unmodifiable view of <code>iterator</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="size(java.util.Iterator)"><!-- --></A><H3> size</H3> <PRE> public static int <B>size</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator)</PRE> <DL> <DD>Returns the number of elements remaining in <code>iterator</code>. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="contains(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator, <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>iterator</code> contains <code>element</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="removeAll(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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>Traverses an iterator and removes every element that belongs to the provided collection. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterator 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>iterator</code></DL> </DD> </DL> <HR> <A NAME="removeIf(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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 every element that satisfies the provided predicate from the iterator. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterator 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 iterator<DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> </DL> </DD> </DL> <HR> <A NAME="retainAll(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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>Traverses an iterator and removes every element that does not belong to the provided collection. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterator 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>iterator</code></DL> </DD> </DL> <HR> <A NAME="elementsEqual(java.util.Iterator, java.util.Iterator)"><!-- --></A><H3> elementsEqual</H3> <PRE> public static boolean <B>elementsEqual</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator1, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator2)</PRE> <DL> <DD>Determines whether two iterators contain equal elements in the same order. More specifically, this method returns <code>true</code> if <code>iterator1</code> and <code>iterator2</code> contain the same number of elements and every element of <code>iterator1</code> is equal to the corresponding element of <code>iterator2</code>. <p>Note that this will modify the supplied iterators, since they will have been advanced some number of elements forward. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="toString(java.util.Iterator)"><!-- --></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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator)</PRE> <DL> <DD>Returns a string representation of <code>iterator</code>, with the format <code>[e1, e2, ..., en]</code>. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getOnlyElement(java.util.Iterator)"><!-- --></A><H3> getOnlyElement</H3> <PRE> public static <T> T <B>getOnlyElement</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</PRE> <DL> <DD>Returns the single element contained in <code>iterator</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 iterator 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 iterator contains multiple elements. The state of the iterator is unspecified.</DL> </DD> </DL> <HR> <A NAME="getOnlyElement(java.util.Iterator,java.lang.Object)"><!-- --></A><A NAME="getOnlyElement(java.util.Iterator, T)"><!-- --></A><H3> getOnlyElement</H3> <PRE> public static <T> T <B>getOnlyElement</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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>iterator</code>, or <code>defaultValue</code> if the iterator 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. The state of the iterator is unspecified.</DL> </DD> </DL> <HR> <A NAME="toArray(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> iterator, <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 iterator's elements into an array. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the iterator 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 iterator have been copied</DL> </DD> </DL> <HR> <A NAME="addAll(java.util.Collection, java.util.Iterator)"><!-- --></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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> iterator)</PRE> <DL> <DD>Adds all elements in <code>iterator</code> to <code>collection</code>. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</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.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><?> iterator, <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 iterator that equal the specified object. The iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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 iterator that cycles indefinitely over the elements of <code>iterable</code>. <p>The returned iterator supports <code>remove()</code> if the provided iterator 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> <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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>cycle</B>(T... elements)</PRE> <DL> <DD>Returns an iterator that cycles indefinitely over the provided elements. <p>The returned iterator supports <code>remove()</code> if the provided iterator does. After <code>remove()</code> is called, subsequent cycles omit the removed element, but <code>elements</code> does not change. 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> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.util.Iterator, java.util.Iterator)"><!-- --></A><H3> concat</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>concat</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> a, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> b)</PRE> <DL> <DD>Combines two iterators into a single iterator. The returned iterator iterates across 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 iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.util.Iterator, java.util.Iterator, java.util.Iterator)"><!-- --></A><H3> concat</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>concat</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> a, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> b, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> c)</PRE> <DL> <DD>Combines three iterators into a single iterator. The returned iterator iterates across 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 iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.util.Iterator, java.util.Iterator, java.util.Iterator, java.util.Iterator)"><!-- --></A><H3> concat</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>concat</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> a, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> b, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> c, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> d)</PRE> <DL> <DD>Combines four iterators into a single iterator. The returned iterator iterates across 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 iterator supports <code>remove()</code> when the corresponding input iterator supports it. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="concat(java.util.Iterator...)"><!-- --></A><H3> concat</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>concat</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T>... inputs)</PRE> <DL> <DD>Combines multiple iterators into a single iterator. The returned iterator iterates across the elements of each iterator in <code>inputs</code>. The input iterators are not polled until necessary. <p>The returned 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 iterators is null</DL> </DD> </DL> <HR> <A NAME="concat(java.util.Iterator)"><!-- --></A><H3> concat</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>concat</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T>> inputs)</PRE> <DL> <DD>Combines multiple iterators into a single iterator. The returned iterator iterates across the elements of each iterator in <code>inputs</code>. The input iterators are not polled until necessary. <p>The returned iterator supports <code>remove()</code> when the corresponding input iterator supports it. The methods of the returned iterator may throw <code>NullPointerException</code> if any of the input iterators are null. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="partition(java.util.Iterator, int)"><!-- --></A><H3> partition</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, int size)</PRE> <DL> <DD>Divides an iterator into unmodifiable sublists of the given size (the final list may be smaller). For example, partitioning an iterator containing <code>[a, b, c, d, e]</code> with a partition size of 3 yields <code>[[a, b, c], [d, e]]</code> -- an outer iterator containing two inner lists of three and two elements, all in the original order. <p>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>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the iterator 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 iterator of immutable lists containing the elements of <code>iterator</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.util.Iterator, int)"><!-- --></A><H3> paddedPartition</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, int size)</PRE> <DL> <DD>Divides an iterator into unmodifiable sublists of the given size, padding the final iterator with null values if necessary. For example, partitioning an iterator 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 iterator containing two inner lists of three elements each, all in the original order. <p>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>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the iterator to return a partitioned view of<DD><CODE>size</CODE> - the desired size of each partition <DT><B>Returns:</B><DD>an iterator of immutable lists containing the elements of <code>iterator</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.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3> filter</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>filter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="filter(java.util.Iterator, java.lang.Class)"><!-- --></A><H3> filter</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>filter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</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 iterator has elements whose class is <code>type</code> or a subclass of <code>type</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>unfiltered</CODE> - an iterator containing objects of any type<DD><CODE>type</CODE> - the type of elements desired <DT><B>Returns:</B><DD>an unmodifiable iterator containing all elements of the original iterator that were of the requested type</DL> </DD> </DL> <HR> <A NAME="any(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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 returned by <code>iterator</code> satisfy the given predicate. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="all(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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 returned by <code>iterator</code> satisfies the given predicate. If <code>iterator</code> is empty, <code>true</code> is returned. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="find(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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>iterator</code> that satisfies the given predicate. If a matching element is found, the iterator will be left in a state such that calling <code>iterator.remove()</code> will remove the found item. If no such element is found, the iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. <P> <DD><DL> <DT><B>Returns:</B><DD>the first matching element in <code>iterator</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 no element in <code>iterator</code> matches the given predicate</DL> </DD> </DL> <HR> <A NAME="indexOf(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, <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>iterator</code> of the first element that satisfies the provided <code>predicate</code>, or <code>-1</code> if the Iterator has no such elements. <p>More formally, returns the lowest index <code>i</code> such that <code>predicate.apply(Iterators.get(iterator, i))</code> is <code>true</code>, or <code>-1</code> if there is no such index. <p>If -1 is returned, the iterator will be left exhausted: its <code>hasNext()</code> method will return <code>false</code>. Otherwise, the iterator will be set to the element which satisfies the <code>predicate</code>. <P> <DD><DL> <DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> </DL> </DD> </DL> <HR> <A NAME="transform(java.util.Iterator, 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/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>transform</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><F> fromIterator, <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 iterator that applies <code>function</code> to each element of <code>fromIterator</code>. <p>The returned iterator supports <code>remove()</code> if the provided iterator does. After a successful <code>remove()</code> call, <code>fromIterator</code> no longer contains the corresponding element. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="get(java.util.Iterator, int)"><!-- --></A><H3> get</H3> <PRE> public static <T> T <B>get</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator, int position)</PRE> <DL> <DD>Advances <code>iterator</code> <code>position + 1</code> times, returning the element at the <code>position</code>th position. <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>iterator</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 number of elements remaining in <code>iterator</code></DL> </DD> </DL> <HR> <A NAME="getLast(java.util.Iterator)"><!-- --></A><H3> getLast</H3> <PRE> public static <T> T <B>getLast</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</PRE> <DL> <DD>Advances <code>iterator</code> to the end, returning the last element. <P> <DD><DL> <DT><B>Returns:</B><DD>the last element of <code>iterator</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 iterator has no remaining elements</DL> </DD> </DL> <HR> <A NAME="consumingIterator(java.util.Iterator)"><!-- --></A><H3> consumingIterator</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> <B>consumingIterator</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</PRE> <DL> <DD>Returns a view of the supplied <code>iterator</code> that removes each element from the supplied <code>iterator</code> as it is returned. <p>The provided iterator must support <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> or else the returned iterator will fail on the first call to <code>next</code>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the iterator to remove and return elements from <DT><B>Returns:</B><DD>an iterator that removes and returns elements from the supplied iterator<DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> </DL> </DD> </DL> <HR> <A NAME="forArray(java.lang.Object[])"><!-- --></A><A NAME="forArray(T...)"><!-- --></A><H3> forArray</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>forArray</B>(T... array)</PRE> <DL> <DD>Returns an iterator containing the elements of <code>array</code> in order. The returned iterator is a view of the array; subsequent changes to the array will be reflected in the iterator. <p><b>Note:</b> It is often preferable to represent your data using a collection type, for example using <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>, making this method unnecessary. <p>The <code>Iterable</code> equivalent of this method is either <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A> or <A HREF="../../../../com/google/common/collect/ImmutableList.html#of(E...)"><CODE>ImmutableList.of(Object[])</CODE></A>}. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="singletonIterator(java.lang.Object)"><!-- --></A><A NAME="singletonIterator(T)"><!-- --></A><H3> singletonIterator</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>singletonIterator</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT> T value)</PRE> <DL> <DD>Returns an iterator containing only <code>value</code>. <p>The <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><CODE>Iterable</CODE></A> equivalent of this method is <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#singleton(T)" title="class or interface in java.util"><CODE>Collections.singleton(T)</CODE></A>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="forEnumeration(java.util.Enumeration)"><!-- --></A><H3> forEnumeration</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A><T> <B>forEnumeration</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Enumeration.html?is-external=true" title="class or interface in java.util">Enumeration</A><T> enumeration)</PRE> <DL> <DD>Adapts an <code>Enumeration</code> to the <code>Iterator</code> interface. <p>This method has no equivalent in <A HREF="../../../../com/google/common/collect/Iterables.html" title="class in com.google.common.collect"><CODE>Iterables</CODE></A> because viewing an <code>Enumeration</code> as an <code>Iterable</code> is impossible. However, the contents can be <i>copied</i> into a collection using <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#list(java.util.Enumeration)" title="class or interface in java.util"><CODE>Collections.list(java.util.Enumeration<T>)</CODE></A>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="asEnumeration(java.util.Iterator)"><!-- --></A><H3> asEnumeration</H3> <PRE> public static <T> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Enumeration.html?is-external=true" title="class or interface in java.util">Enumeration</A><T> <B>asEnumeration</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><T> iterator)</PRE> <DL> <DD>Adapts an <code>Iterator</code> to the <code>Enumeration</code> interface. <p>The <code>Iterable</code> equivalent of this method is either <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collections.html?is-external=true#enumeration(java.util.Collection)" title="class or interface in java.util"><CODE>Collections.enumeration(java.util.Collection<T>)</CODE></A> (if you have a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util"><CODE>Collection</CODE></A>), or <code>Iterators.asEnumeration(collection.iterator())</code>. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="peekingIterator(java.util.Iterator)"><!-- --></A><H3> peekingIterator</H3> <PRE> public static <T> <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect">PeekingIterator</A><T> <B>peekingIterator</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><? extends T> iterator)</PRE> <DL> <DD>Returns a <code>PeekingIterator</code> backed by the given iterator. <p>Calls to the <code>peek</code> method with no intervening calls to <code>next</code> do not affect the iteration, and hence return the same object each time. A subsequent call to <code>next</code> is guaranteed to return the same object again. For example: <pre> <code>PeekingIterator<String> peekingIterator = Iterators.peekingIterator(Iterators.forArray("a", "b")); String a1 = peekingIterator.peek(); // returns "a" String a2 = peekingIterator.peek(); // also returns "a" String a3 = peekingIterator.next(); // also returns "a"</code></pre> Any structural changes to the underlying iteration (aside from those performed by the iterator's own <A HREF="../../../../com/google/common/collect/PeekingIterator.html#remove()"><CODE>PeekingIterator.remove()</CODE></A> method) will leave the iterator in an undefined state. <p>The returned iterator does not support removal after peeking, as explained by <A HREF="../../../../com/google/common/collect/PeekingIterator.html#remove()"><CODE>PeekingIterator.remove()</CODE></A>. <p>Note: If the given iterator is already a <code>PeekingIterator</code>, it <i>might</i> be returned to the caller, although this is neither guaranteed to occur nor required to be consistent. For example, this method <i>might</i> choose to pass through recognized implementations of <code>PeekingIterator</code> when the behavior of the implementation is known to meet the contract guaranteed by this method. <p>There is no <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><CODE>Iterable</CODE></A> equivalent to this method, so use this method to wrap each individual iterator as it is generated. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the backing iterator. The <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect"><CODE>PeekingIterator</CODE></A> assumes ownership of this iterator, so users should cease making direct calls to it after calling this method. <DT><B>Returns:</B><DD>a peeking iterator backed by that iterator. Apart from the additional <A HREF="../../../../com/google/common/collect/PeekingIterator.html#peek()"><CODE>PeekingIterator.peek()</CODE></A> method, this iterator behaves exactly the same as <code>iterator</code>.</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/Iterators.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/Iterables.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A> <A HREF="../../../../com/google/common/collect/LinkedHashMultimap.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/Iterators.html" target="_top"><B>FRAMES</B></A> <A HREF="Iterators.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>