• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 -->
6<TITLE>
7Iterators (Guava Libraries 2010.01.04)
8</TITLE>
9
10<META NAME="date" CONTENT="2010-01-04">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    if (location.href.indexOf('is-external=true') == -1) {
18        parent.document.title="Iterators (Guava Libraries 2010.01.04)";
19    }
20}
21</SCRIPT>
22<NOSCRIPT>
23</NOSCRIPT>
24
25</HEAD>
26
27<BODY BGCOLOR="white" onload="windowTitle();">
28<HR>
29
30
31<!-- ========= START OF TOP NAVBAR ======= -->
32<A NAME="navbar_top"><!-- --></A>
33<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35<TR>
36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37<A NAME="navbar_top_firstrow"><!-- --></A>
38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39  <TR ALIGN="center" VALIGN="top">
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Iterators.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48  </TR>
49</TABLE>
50</TD>
51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58&nbsp;<A HREF="../../../../com/google/common/collect/Iterables.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../com/google/common/collect/LinkedHashMultimap.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../index.html?com/google/common/collect/Iterators.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Iterators.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<SCRIPT type="text/javascript">
64  <!--
65  if(window==top) {
66    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67  }
68  //-->
69</SCRIPT>
70<NOSCRIPT>
71  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
72</NOSCRIPT>
73
74
75</FONT></TD>
76</TR>
77<TR>
78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
79  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
82</TR>
83</TABLE>
84<A NAME="skip-navbar_top"></A>
85<!-- ========= END OF TOP NAVBAR ========= -->
86
87<HR>
88<!-- ======== START OF CLASS DATA ======== -->
89<H2>
90<FONT SIZE="-1">
91com.google.common.collect</FONT>
92<BR>
93Class Iterators</H2>
94<PRE>
95<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
96  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.collect.Iterators</B>
97</PRE>
98<HR>
99<DL>
100<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>
101</PRE>
102
103<P>
104This class contains static utility methods that operate on or return objects
105 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
106 <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.
107<P>
108
109<P>
110<DL>
111<DT><B>Since:</B></DT>
112  <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD>
113<DT><B>Author:</B></DT>
114  <DD>Kevin Bourrillion, Jared Levy</DD>
115</DL>
116<HR>
117
118<P>
119
120<!-- ========== METHOD SUMMARY =========== -->
121
122<A NAME="method_summary"><!-- --></A>
123<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
124<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
125<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
126<B>Method Summary</B></FONT></TH>
127</TR>
128<TR BGCOLOR="white" CLASS="TableRowColor">
129<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
130<CODE>static
131<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
132<TR ALIGN="right" VALIGN="">
133<TD NOWRAP><FONT SIZE="-1">
134<CODE>&lt;T&gt; boolean</CODE></FONT></TD>
135</TR>
136</TABLE>
137</CODE></FONT></TD>
138<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>&lt;T&gt;&nbsp;addTo,
139       <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>&lt;? extends T&gt;&nbsp;iterator)</CODE>
140
141<BR>
142&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds all elements in <code>iterator</code> to <code>collection</code>.</TD>
143</TR>
144<TR BGCOLOR="white" CLASS="TableRowColor">
145<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
146<CODE>static
147<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
148<TR ALIGN="right" VALIGN="">
149<TD NOWRAP><FONT SIZE="-1">
150<CODE>&lt;T&gt; boolean</CODE></FONT></TD>
151</TR>
152</TABLE>
153</CODE></FONT></TD>
154<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>&lt;T&gt;&nbsp;iterator,
155    <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</CODE>
156
157<BR>
158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if every element returned by <code>iterator</code>
159 satisfies the given predicate.</TD>
160</TR>
161<TR BGCOLOR="white" CLASS="TableRowColor">
162<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
163<CODE>static
164<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
165<TR ALIGN="right" VALIGN="">
166<TD NOWRAP><FONT SIZE="-1">
167<CODE>&lt;T&gt; boolean</CODE></FONT></TD>
168</TR>
169</TABLE>
170</CODE></FONT></TD>
171<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>&lt;T&gt;&nbsp;iterator,
172    <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</CODE>
173
174<BR>
175&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if one or more elements returned by <code>iterator</code>
176 satisfy the given predicate.</TD>
177</TR>
178<TR BGCOLOR="white" CLASS="TableRowColor">
179<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
180<CODE>static
181<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
182<TR ALIGN="right" VALIGN="">
183<TD NOWRAP><FONT SIZE="-1">
184<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
185</TR>
186</TABLE>
187</CODE></FONT></TD>
188<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>&lt;T&gt;&nbsp;iterator)</CODE>
189
190<BR>
191&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adapts an <code>Iterator</code> to the <code>Enumeration</code> interface.</TD>
192</TR>
193<TR BGCOLOR="white" CLASS="TableRowColor">
194<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
195<CODE>static
196<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
197<TR ALIGN="right" VALIGN="">
198<TD NOWRAP><FONT SIZE="-1">
199<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
200</TR>
201</TABLE>
202</CODE></FONT></TD>
203<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>&lt;? 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>&lt;? extends T&gt;&gt;&nbsp;inputs)</CODE>
204
205<BR>
206&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combines multiple iterators into a single iterator.</TD>
207</TR>
208<TR BGCOLOR="white" CLASS="TableRowColor">
209<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
210<CODE>static
211<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
212<TR ALIGN="right" VALIGN="">
213<TD NOWRAP><FONT SIZE="-1">
214<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
215</TR>
216</TABLE>
217</CODE></FONT></TD>
218<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>&lt;? extends T&gt;...&nbsp;inputs)</CODE>
219
220<BR>
221&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combines multiple iterators into a single iterator.</TD>
222</TR>
223<TR BGCOLOR="white" CLASS="TableRowColor">
224<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
225<CODE>static
226<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
227<TR ALIGN="right" VALIGN="">
228<TD NOWRAP><FONT SIZE="-1">
229<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
230</TR>
231</TABLE>
232</CODE></FONT></TD>
233<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>&lt;? extends T&gt;&nbsp;a,
234       <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>&lt;? extends T&gt;&nbsp;b)</CODE>
235
236<BR>
237&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combines two iterators into a single iterator.</TD>
238</TR>
239<TR BGCOLOR="white" CLASS="TableRowColor">
240<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
241<CODE>static
242<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
243<TR ALIGN="right" VALIGN="">
244<TD NOWRAP><FONT SIZE="-1">
245<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
246</TR>
247</TABLE>
248</CODE></FONT></TD>
249<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>&lt;? extends T&gt;&nbsp;a,
250       <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>&lt;? extends T&gt;&nbsp;b,
251       <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>&lt;? extends T&gt;&nbsp;c)</CODE>
252
253<BR>
254&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combines three iterators into a single iterator.</TD>
255</TR>
256<TR BGCOLOR="white" CLASS="TableRowColor">
257<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
258<CODE>static
259<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
260<TR ALIGN="right" VALIGN="">
261<TD NOWRAP><FONT SIZE="-1">
262<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
263</TR>
264</TABLE>
265</CODE></FONT></TD>
266<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>&lt;? extends T&gt;&nbsp;a,
267       <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>&lt;? extends T&gt;&nbsp;b,
268       <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>&lt;? extends T&gt;&nbsp;c,
269       <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>&lt;? extends T&gt;&nbsp;d)</CODE>
270
271<BR>
272&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combines four iterators into a single iterator.</TD>
273</TR>
274<TR BGCOLOR="white" CLASS="TableRowColor">
275<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
276<CODE>static
277<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
278<TR ALIGN="right" VALIGN="">
279<TD NOWRAP><FONT SIZE="-1">
280<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
281</TR>
282</TABLE>
283</CODE></FONT></TD>
284<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>&lt;T&gt;&nbsp;iterator)</CODE>
285
286<BR>
287&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a view of the supplied <code>iterator</code> that removes each element
288 from the supplied <code>iterator</code> as it is returned.</TD>
289</TR>
290<TR BGCOLOR="white" CLASS="TableRowColor">
291<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
292<CODE>static&nbsp;boolean</CODE></FONT></TD>
293<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>&lt;?&gt;&nbsp;iterator,
294         <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>&nbsp;element)</CODE>
295
296<BR>
297&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if <code>iterator</code> contains <code>element</code>.</TD>
298</TR>
299<TR BGCOLOR="white" CLASS="TableRowColor">
300<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
301<CODE>static
302<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
303<TR ALIGN="right" VALIGN="">
304<TD NOWRAP><FONT SIZE="-1">
305<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
306</TR>
307</TABLE>
308</CODE></FONT></TD>
309<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>&lt;T&gt;&nbsp;iterable)</CODE>
310
311<BR>
312&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator that cycles indefinitely over the elements of <code>iterable</code>.</TD>
313</TR>
314<TR BGCOLOR="white" CLASS="TableRowColor">
315<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
316<CODE>static
317<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
318<TR ALIGN="right" VALIGN="">
319<TD NOWRAP><FONT SIZE="-1">
320<CODE>&lt;T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
321</TR>
322</TABLE>
323</CODE></FONT></TD>
324<TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#cycle(T...)">cycle</A></B>(T...&nbsp;elements)</CODE>
325
326<BR>
327&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator that cycles indefinitely over the provided elements.</TD>
328</TR>
329<TR BGCOLOR="white" CLASS="TableRowColor">
330<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
331<CODE>static&nbsp;boolean</CODE></FONT></TD>
332<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>&lt;?&gt;&nbsp;iterator1,
333              <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>&lt;?&gt;&nbsp;iterator2)</CODE>
334
335<BR>
336&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Determines whether two iterators contain equal elements in the same order.</TD>
337</TR>
338<TR BGCOLOR="white" CLASS="TableRowColor">
339<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
340<CODE>static
341<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
342<TR ALIGN="right" VALIGN="">
343<TD NOWRAP><FONT SIZE="-1">
344<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
345</TR>
346</TABLE>
347</CODE></FONT></TD>
348<TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#emptyIterator()">emptyIterator</A></B>()</CODE>
349
350<BR>
351&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the empty iterator.</TD>
352</TR>
353<TR BGCOLOR="white" CLASS="TableRowColor">
354<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
355<CODE>static
356<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
357<TR ALIGN="right" VALIGN="">
358<TD NOWRAP><FONT SIZE="-1">
359<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
360</TR>
361</TABLE>
362</CODE></FONT></TD>
363<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>&lt;?&gt;&nbsp;unfiltered,
364       <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>&lt;T&gt;&nbsp;type)</CODE>
365
366<BR>
367&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns all instances of class <code>type</code> in <code>unfiltered</code>.</TD>
368</TR>
369<TR BGCOLOR="white" CLASS="TableRowColor">
370<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
371<CODE>static
372<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
373<TR ALIGN="right" VALIGN="">
374<TD NOWRAP><FONT SIZE="-1">
375<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
376</TR>
377</TABLE>
378</CODE></FONT></TD>
379<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>&lt;T&gt;&nbsp;unfiltered,
380       <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</CODE>
381
382<BR>
383&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the elements of <code>unfiltered</code> that satisfy a predicate.</TD>
384</TR>
385<TR BGCOLOR="white" CLASS="TableRowColor">
386<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
387<CODE>static
388<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
389<TR ALIGN="right" VALIGN="">
390<TD NOWRAP><FONT SIZE="-1">
391<CODE>&lt;T&gt; T</CODE></FONT></TD>
392</TR>
393</TABLE>
394</CODE></FONT></TD>
395<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>&lt;T&gt;&nbsp;iterator,
396     <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</CODE>
397
398<BR>
399&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the first element in <code>iterator</code> that satisfies the given
400 predicate.</TD>
401</TR>
402<TR BGCOLOR="white" CLASS="TableRowColor">
403<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
404<CODE>static
405<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
406<TR ALIGN="right" VALIGN="">
407<TD NOWRAP><FONT SIZE="-1">
408<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
409</TR>
410</TABLE>
411</CODE></FONT></TD>
412<TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#forArray(T...)">forArray</A></B>(T...&nbsp;array)</CODE>
413
414<BR>
415&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator containing the elements of <code>array</code> in order.</TD>
416</TR>
417<TR BGCOLOR="white" CLASS="TableRowColor">
418<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
419<CODE>static
420<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
421<TR ALIGN="right" VALIGN="">
422<TD NOWRAP><FONT SIZE="-1">
423<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
424</TR>
425</TABLE>
426</CODE></FONT></TD>
427<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>&lt;T&gt;&nbsp;enumeration)</CODE>
428
429<BR>
430&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adapts an <code>Enumeration</code> to the <code>Iterator</code> interface.</TD>
431</TR>
432<TR BGCOLOR="white" CLASS="TableRowColor">
433<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
434<CODE>static&nbsp;int</CODE></FONT></TD>
435<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>&lt;?&gt;&nbsp;iterator,
436          <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>&nbsp;element)</CODE>
437
438<BR>
439&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of elements in the specified iterator that equal the
440 specified object.</TD>
441</TR>
442<TR BGCOLOR="white" CLASS="TableRowColor">
443<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
444<CODE>static
445<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
446<TR ALIGN="right" VALIGN="">
447<TD NOWRAP><FONT SIZE="-1">
448<CODE>&lt;T&gt; T</CODE></FONT></TD>
449</TR>
450</TABLE>
451</CODE></FONT></TD>
452<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>&lt;T&gt;&nbsp;iterator,
453    int&nbsp;position)</CODE>
454
455<BR>
456&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Advances <code>iterator</code> <code>position + 1</code> times, returning the element
457 at the <code>position</code>th position.</TD>
458</TR>
459<TR BGCOLOR="white" CLASS="TableRowColor">
460<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
461<CODE>static
462<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
463<TR ALIGN="right" VALIGN="">
464<TD NOWRAP><FONT SIZE="-1">
465<CODE>&lt;T&gt; T</CODE></FONT></TD>
466</TR>
467</TABLE>
468</CODE></FONT></TD>
469<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>&lt;T&gt;&nbsp;iterator)</CODE>
470
471<BR>
472&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Advances <code>iterator</code> to the end, returning the last element.</TD>
473</TR>
474<TR BGCOLOR="white" CLASS="TableRowColor">
475<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
476<CODE>static
477<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
478<TR ALIGN="right" VALIGN="">
479<TD NOWRAP><FONT SIZE="-1">
480<CODE>&lt;T&gt; T</CODE></FONT></TD>
481</TR>
482</TABLE>
483</CODE></FONT></TD>
484<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>&lt;T&gt;&nbsp;iterator)</CODE>
485
486<BR>
487&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the single element contained in <code>iterator</code>.</TD>
488</TR>
489<TR BGCOLOR="white" CLASS="TableRowColor">
490<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
491<CODE>static
492<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
493<TR ALIGN="right" VALIGN="">
494<TD NOWRAP><FONT SIZE="-1">
495<CODE>&lt;T&gt; T</CODE></FONT></TD>
496</TR>
497</TABLE>
498</CODE></FONT></TD>
499<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>&lt;T&gt;&nbsp;iterator,
500               T&nbsp;defaultValue)</CODE>
501
502<BR>
503&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the single element contained in <code>iterator</code>, or <code>defaultValue</code> if the iterator is empty.</TD>
504</TR>
505<TR BGCOLOR="white" CLASS="TableRowColor">
506<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
507<CODE>static
508<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
509<TR ALIGN="right" VALIGN="">
510<TD NOWRAP><FONT SIZE="-1">
511<CODE>&lt;T&gt; int</CODE></FONT></TD>
512</TR>
513</TABLE>
514</CODE></FONT></TD>
515<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>&lt;T&gt;&nbsp;iterator,
516        <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</CODE>
517
518<BR>
519&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index in <code>iterator</code> of the first element that satisfies
520 the provided <code>predicate</code>, or <code>-1</code> if the Iterator has no such
521 elements.</TD>
522</TR>
523<TR BGCOLOR="white" CLASS="TableRowColor">
524<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
525<CODE>static
526<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
527<TR ALIGN="right" VALIGN="">
528<TD NOWRAP><FONT SIZE="-1">
529<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;<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>&lt;T&gt;&gt;</CODE></FONT></TD>
530</TR>
531</TABLE>
532</CODE></FONT></TD>
533<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>&lt;T&gt;&nbsp;iterator,
534                int&nbsp;size)</CODE>
535
536<BR>
537&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Divides an iterator into unmodifiable sublists of the given size, padding
538 the final iterator with null values if necessary.</TD>
539</TR>
540<TR BGCOLOR="white" CLASS="TableRowColor">
541<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
542<CODE>static
543<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
544<TR ALIGN="right" VALIGN="">
545<TD NOWRAP><FONT SIZE="-1">
546<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;<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>&lt;T&gt;&gt;</CODE></FONT></TD>
547</TR>
548</TABLE>
549</CODE></FONT></TD>
550<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>&lt;T&gt;&nbsp;iterator,
551          int&nbsp;size)</CODE>
552
553<BR>
554&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Divides an iterator into unmodifiable sublists of the given size (the final
555 list may be smaller).</TD>
556</TR>
557<TR BGCOLOR="white" CLASS="TableRowColor">
558<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
559<CODE>static
560<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
561<TR ALIGN="right" VALIGN="">
562<TD NOWRAP><FONT SIZE="-1">
563<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect">PeekingIterator</A>&lt;T&gt;</CODE></FONT></TD>
564</TR>
565</TABLE>
566</CODE></FONT></TD>
567<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>&lt;? extends T&gt;&nbsp;iterator)</CODE>
568
569<BR>
570&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>PeekingIterator</code> backed by the given iterator.</TD>
571</TR>
572<TR BGCOLOR="white" CLASS="TableRowColor">
573<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
574<CODE>static&nbsp;boolean</CODE></FONT></TD>
575<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>&lt;?&gt;&nbsp;removeFrom,
576          <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>&lt;?&gt;&nbsp;elementsToRemove)</CODE>
577
578<BR>
579&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Traverses an iterator and removes every element that belongs to the
580 provided collection.</TD>
581</TR>
582<TR BGCOLOR="white" CLASS="TableRowColor">
583<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
584<CODE>static
585<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
586<TR ALIGN="right" VALIGN="">
587<TD NOWRAP><FONT SIZE="-1">
588<CODE>&lt;T&gt; boolean</CODE></FONT></TD>
589</TR>
590</TABLE>
591</CODE></FONT></TD>
592<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>&lt;T&gt;&nbsp;removeFrom,
593         <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</CODE>
594
595<BR>
596&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes every element that satisfies the provided predicate from the
597 iterator.</TD>
598</TR>
599<TR BGCOLOR="white" CLASS="TableRowColor">
600<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
601<CODE>static&nbsp;boolean</CODE></FONT></TD>
602<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>&lt;?&gt;&nbsp;removeFrom,
603          <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>&lt;?&gt;&nbsp;elementsToRetain)</CODE>
604
605<BR>
606&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Traverses an iterator and removes every element that does not belong to the
607 provided collection.</TD>
608</TR>
609<TR BGCOLOR="white" CLASS="TableRowColor">
610<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
611<CODE>static
612<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
613<TR ALIGN="right" VALIGN="">
614<TD NOWRAP><FONT SIZE="-1">
615<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
616</TR>
617</TABLE>
618</CODE></FONT></TD>
619<TD><CODE><B><A HREF="../../../../com/google/common/collect/Iterators.html#singletonIterator(T)">singletonIterator</A></B>(T&nbsp;value)</CODE>
620
621<BR>
622&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator containing only <code>value</code>.</TD>
623</TR>
624<TR BGCOLOR="white" CLASS="TableRowColor">
625<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
626<CODE>static&nbsp;int</CODE></FONT></TD>
627<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>&lt;?&gt;&nbsp;iterator)</CODE>
628
629<BR>
630&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of elements remaining in <code>iterator</code>.</TD>
631</TR>
632<TR BGCOLOR="white" CLASS="TableRowColor">
633<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
634<CODE>static
635<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
636<TR ALIGN="right" VALIGN="">
637<TD NOWRAP><FONT SIZE="-1">
638<CODE>&lt;T&gt; T[]</CODE></FONT></TD>
639</TR>
640</TABLE>
641</CODE></FONT></TD>
642<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>&lt;? extends T&gt;&nbsp;iterator,
643        <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>&lt;T&gt;&nbsp;type)</CODE>
644
645<BR>
646&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies an iterator's elements into an array.</TD>
647</TR>
648<TR BGCOLOR="white" CLASS="TableRowColor">
649<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
650<CODE>static&nbsp;<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>
651<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>&lt;?&gt;&nbsp;iterator)</CODE>
652
653<BR>
654&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a string representation of <code>iterator</code>, with the format
655 <code>[e1, e2, ..., en]</code>.</TD>
656</TR>
657<TR BGCOLOR="white" CLASS="TableRowColor">
658<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
659<CODE>static
660<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
661<TR ALIGN="right" VALIGN="">
662<TD NOWRAP><FONT SIZE="-1">
663<CODE>&lt;F,T&gt; <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>&lt;T&gt;</CODE></FONT></TD>
664</TR>
665</TABLE>
666</CODE></FONT></TD>
667<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>&lt;F&gt;&nbsp;fromIterator,
668          <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super F,? extends T&gt;&nbsp;function)</CODE>
669
670<BR>
671&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator that applies <code>function</code> to each element of <code>fromIterator</code>.</TD>
672</TR>
673<TR BGCOLOR="white" CLASS="TableRowColor">
674<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
675<CODE>static
676<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
677<TR ALIGN="right" VALIGN="">
678<TD NOWRAP><FONT SIZE="-1">
679<CODE>&lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt;</CODE></FONT></TD>
680</TR>
681</TABLE>
682</CODE></FONT></TD>
683<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>&lt;T&gt;&nbsp;iterator)</CODE>
684
685<BR>
686&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable view of <code>iterator</code>.</TD>
687</TR>
688</TABLE>
689&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
690<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
691<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
692<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>
693</TR>
694<TR BGCOLOR="white" CLASS="TableRowColor">
695<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>
696</TR>
697</TABLE>
698&nbsp;
699<P>
700
701<!-- ============ METHOD DETAIL ========== -->
702
703<A NAME="method_detail"><!-- --></A>
704<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
705<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
706<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
707<B>Method Detail</B></FONT></TH>
708</TR>
709</TABLE>
710
711<A NAME="emptyIterator()"><!-- --></A><H3>
712emptyIterator</H3>
713<PRE>
714public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <B>emptyIterator</B>()</PRE>
715<DL>
716<DD>Returns the empty iterator.
717
718 <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>.
719<P>
720<DD><DL>
721</DL>
722</DD>
723</DL>
724<HR>
725
726<A NAME="unmodifiableIterator(java.util.Iterator)"><!-- --></A><H3>
727unmodifiableIterator</H3>
728<PRE>
729public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <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>&lt;T&gt;&nbsp;iterator)</PRE>
730<DL>
731<DD>Returns an unmodifiable view of <code>iterator</code>.
732<P>
733<DD><DL>
734</DL>
735</DD>
736</DL>
737<HR>
738
739<A NAME="size(java.util.Iterator)"><!-- --></A><H3>
740size</H3>
741<PRE>
742public 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>&lt;?&gt;&nbsp;iterator)</PRE>
743<DL>
744<DD>Returns the number of elements remaining in <code>iterator</code>. The iterator
745 will be left exhausted: its <code>hasNext()</code> method will return
746 <code>false</code>.
747<P>
748<DD><DL>
749</DL>
750</DD>
751</DL>
752<HR>
753
754<A NAME="contains(java.util.Iterator, java.lang.Object)"><!-- --></A><H3>
755contains</H3>
756<PRE>
757public 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>&lt;?&gt;&nbsp;iterator,
758                               <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>
759                               <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>&nbsp;element)</PRE>
760<DL>
761<DD>Returns <code>true</code> if <code>iterator</code> contains <code>element</code>.
762<P>
763<DD><DL>
764</DL>
765</DD>
766</DL>
767<HR>
768
769<A NAME="removeAll(java.util.Iterator, java.util.Collection)"><!-- --></A><H3>
770removeAll</H3>
771<PRE>
772public 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>&lt;?&gt;&nbsp;removeFrom,
773                                <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>&lt;?&gt;&nbsp;elementsToRemove)</PRE>
774<DL>
775<DD>Traverses an iterator and removes every element that belongs to the
776 provided collection. The iterator will be left exhausted: its
777 <code>hasNext()</code> method will return <code>false</code>.
778<P>
779<DD><DL>
780<DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterator to (potentially) remove elements from<DD><CODE>elementsToRemove</CODE> - the elements to remove
781<DT><B>Returns:</B><DD><code>true</code> if any elements are removed from <code>iterator</code></DL>
782</DD>
783</DL>
784<HR>
785
786<A NAME="removeIf(java.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3>
787removeIf</H3>
788<PRE>
789public static &lt;T&gt; 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>&lt;T&gt;&nbsp;removeFrom,
790                                   <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</PRE>
791<DL>
792<DD>Removes every element that satisfies the provided predicate from the
793 iterator. The iterator will be left exhausted: its <code>hasNext()</code>
794 method will return <code>false</code>.
795<P>
796<DD><DL>
797<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
798     be removed
799<DT><B>Returns:</B><DD><code>true</code> if any elements were removed from the iterator<DT><B>Since:</B></DT>
800  <DD>2010.01.04 <b>tentative</b></DD>
801</DL>
802</DD>
803</DL>
804<HR>
805
806<A NAME="retainAll(java.util.Iterator, java.util.Collection)"><!-- --></A><H3>
807retainAll</H3>
808<PRE>
809public 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>&lt;?&gt;&nbsp;removeFrom,
810                                <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>&lt;?&gt;&nbsp;elementsToRetain)</PRE>
811<DL>
812<DD>Traverses an iterator and removes every element that does not belong to the
813 provided collection. The iterator will be left exhausted: its
814 <code>hasNext()</code> method will return <code>false</code>.
815<P>
816<DD><DL>
817<DT><B>Parameters:</B><DD><CODE>removeFrom</CODE> - the iterator to (potentially) remove elements from<DD><CODE>elementsToRetain</CODE> - the elements to retain
818<DT><B>Returns:</B><DD><code>true</code> if any elements are removed from <code>iterator</code></DL>
819</DD>
820</DL>
821<HR>
822
823<A NAME="elementsEqual(java.util.Iterator, java.util.Iterator)"><!-- --></A><H3>
824elementsEqual</H3>
825<PRE>
826public 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>&lt;?&gt;&nbsp;iterator1,
827                                    <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>&lt;?&gt;&nbsp;iterator2)</PRE>
828<DL>
829<DD>Determines whether two iterators contain equal elements in the same order.
830 More specifically, this method returns <code>true</code> if <code>iterator1</code>
831 and <code>iterator2</code> contain the same number of elements and every element
832 of <code>iterator1</code> is equal to the corresponding element of
833 <code>iterator2</code>.
834
835 <p>Note that this will modify the supplied iterators, since they will have
836 been advanced some number of elements forward.
837<P>
838<DD><DL>
839</DL>
840</DD>
841</DL>
842<HR>
843
844<A NAME="toString(java.util.Iterator)"><!-- --></A><H3>
845toString</H3>
846<PRE>
847public 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>&lt;?&gt;&nbsp;iterator)</PRE>
848<DL>
849<DD>Returns a string representation of <code>iterator</code>, with the format
850 <code>[e1, e2, ..., en]</code>. The iterator will be left exhausted: its
851 <code>hasNext()</code> method will return <code>false</code>.
852<P>
853<DD><DL>
854</DL>
855</DD>
856</DL>
857<HR>
858
859<A NAME="getOnlyElement(java.util.Iterator)"><!-- --></A><H3>
860getOnlyElement</H3>
861<PRE>
862public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator)</PRE>
863<DL>
864<DD>Returns the single element contained in <code>iterator</code>.
865<P>
866<DD><DL>
867
868<DT><B>Throws:</B>
869<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
870<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
871     elements.  The state of the iterator is unspecified.</DL>
872</DD>
873</DL>
874<HR>
875
876<A NAME="getOnlyElement(java.util.Iterator,java.lang.Object)"><!-- --></A><A NAME="getOnlyElement(java.util.Iterator, T)"><!-- --></A><H3>
877getOnlyElement</H3>
878<PRE>
879public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator,
880                                   <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>
881                                   T&nbsp;defaultValue)</PRE>
882<DL>
883<DD>Returns the single element contained in <code>iterator</code>, or <code>defaultValue</code> if the iterator is empty.
884<P>
885<DD><DL>
886
887<DT><B>Throws:</B>
888<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
889     elements.  The state of the iterator is unspecified.</DL>
890</DD>
891</DL>
892<HR>
893
894<A NAME="toArray(java.util.Iterator, java.lang.Class)"><!-- --></A><H3>
895toArray</H3>
896<PRE>
897public static &lt;T&gt; 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>&lt;? extends T&gt;&nbsp;iterator,
898                              <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>&lt;T&gt;&nbsp;type)</PRE>
899<DL>
900<DD>Copies an iterator's elements into an array. The iterator will be left
901 exhausted: its <code>hasNext()</code> method will return <code>false</code>.
902<P>
903<DD><DL>
904<DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the iterator to copy<DD><CODE>type</CODE> - the type of the elements
905<DT><B>Returns:</B><DD>a newly-allocated array into which all the elements of the iterator
906         have been copied</DL>
907</DD>
908</DL>
909<HR>
910
911<A NAME="addAll(java.util.Collection, java.util.Iterator)"><!-- --></A><H3>
912addAll</H3>
913<PRE>
914public static &lt;T&gt; 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>&lt;T&gt;&nbsp;addTo,
915                                 <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>&lt;? extends T&gt;&nbsp;iterator)</PRE>
916<DL>
917<DD>Adds all elements in <code>iterator</code> to <code>collection</code>. The iterator
918 will be left exhausted: its <code>hasNext()</code> method will return
919 <code>false</code>.
920<P>
921<DD><DL>
922
923<DT><B>Returns:</B><DD><code>true</code> if <code>collection</code> was modified as a result of this
924         operation</DL>
925</DD>
926</DL>
927<HR>
928
929<A NAME="frequency(java.util.Iterator, java.lang.Object)"><!-- --></A><H3>
930frequency</H3>
931<PRE>
932public 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>&lt;?&gt;&nbsp;iterator,
933                            <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>
934                            <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>&nbsp;element)</PRE>
935<DL>
936<DD>Returns the number of elements in the specified iterator that equal the
937 specified object. The iterator will be left exhausted: its
938 <code>hasNext()</code> method will return <code>false</code>.
939<P>
940<DD><DL>
941<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>
942</DD>
943</DL>
944<HR>
945
946<A NAME="cycle(java.lang.Iterable)"><!-- --></A><H3>
947cycle</H3>
948<PRE>
949public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;T&gt;&nbsp;iterable)</PRE>
950<DL>
951<DD>Returns an iterator that cycles indefinitely over the elements of <code>iterable</code>.
952
953 <p>The returned iterator supports <code>remove()</code> if the provided iterator
954 does. After <code>remove()</code> is called, subsequent cycles omit the removed
955 element, which is no longer in <code>iterable</code>. The iterator's
956 <code>hasNext()</code> method returns <code>true</code> until <code>iterable</code> is
957 empty.
958
959 <p><b>Warning:</b> Typical uses of the resulting iterator may produce an
960 infinite loop. You should use an explicit <code>break</code> or be certain that
961 you will eventually remove all the elements.
962<P>
963<DD><DL>
964</DL>
965</DD>
966</DL>
967<HR>
968
969<A NAME="cycle(java.lang.Object[])"><!-- --></A><A NAME="cycle(T...)"><!-- --></A><H3>
970cycle</H3>
971<PRE>
972public static &lt;T&gt; <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>&lt;T&gt; <B>cycle</B>(T...&nbsp;elements)</PRE>
973<DL>
974<DD>Returns an iterator that cycles indefinitely over the provided elements.
975
976 <p>The returned iterator supports <code>remove()</code> if the provided iterator
977 does. After <code>remove()</code> is called, subsequent cycles omit the removed
978 element, but <code>elements</code> does not change. The iterator's
979 <code>hasNext()</code> method returns <code>true</code> until all of the original
980 elements have been removed.
981
982 <p><b>Warning:</b> Typical uses of the resulting iterator may produce an
983 infinite loop. You should use an explicit <code>break</code> or be certain that
984 you will eventually remove all the elements.
985<P>
986<DD><DL>
987</DL>
988</DD>
989</DL>
990<HR>
991
992<A NAME="concat(java.util.Iterator, java.util.Iterator)"><!-- --></A><H3>
993concat</H3>
994<PRE>
995public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;? extends T&gt;&nbsp;a,
996                                     <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>&lt;? extends T&gt;&nbsp;b)</PRE>
997<DL>
998<DD>Combines two iterators into a single iterator. The returned iterator
999 iterates across the elements in <code>a</code>, followed by the elements in
1000 <code>b</code>. The source iterators are not polled until necessary.
1001
1002 <p>The returned iterator supports <code>remove()</code> when the corresponding
1003 input iterator supports it.
1004<P>
1005<DD><DL>
1006</DL>
1007</DD>
1008</DL>
1009<HR>
1010
1011<A NAME="concat(java.util.Iterator, java.util.Iterator, java.util.Iterator)"><!-- --></A><H3>
1012concat</H3>
1013<PRE>
1014public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;? extends T&gt;&nbsp;a,
1015                                     <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>&lt;? extends T&gt;&nbsp;b,
1016                                     <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>&lt;? extends T&gt;&nbsp;c)</PRE>
1017<DL>
1018<DD>Combines three iterators into a single iterator. The returned iterator
1019 iterates across the elements in <code>a</code>, followed by the elements in
1020 <code>b</code>, followed by the elements in <code>c</code>. The source iterators
1021 are not polled until necessary.
1022
1023 <p>The returned iterator supports <code>remove()</code> when the corresponding
1024 input iterator supports it.
1025<P>
1026<DD><DL>
1027</DL>
1028</DD>
1029</DL>
1030<HR>
1031
1032<A NAME="concat(java.util.Iterator, java.util.Iterator, java.util.Iterator, java.util.Iterator)"><!-- --></A><H3>
1033concat</H3>
1034<PRE>
1035public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;? extends T&gt;&nbsp;a,
1036                                     <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>&lt;? extends T&gt;&nbsp;b,
1037                                     <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>&lt;? extends T&gt;&nbsp;c,
1038                                     <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>&lt;? extends T&gt;&nbsp;d)</PRE>
1039<DL>
1040<DD>Combines four iterators into a single iterator. The returned iterator
1041 iterates across the elements in <code>a</code>, followed by the elements in
1042 <code>b</code>, followed by the elements in <code>c</code>, followed by the elements
1043 in <code>d</code>. The source iterators are not polled until necessary.
1044
1045 <p>The returned iterator supports <code>remove()</code> when the corresponding
1046 input iterator supports it.
1047<P>
1048<DD><DL>
1049</DL>
1050</DD>
1051</DL>
1052<HR>
1053
1054<A NAME="concat(java.util.Iterator...)"><!-- --></A><H3>
1055concat</H3>
1056<PRE>
1057public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;? extends T&gt;...&nbsp;inputs)</PRE>
1058<DL>
1059<DD>Combines multiple iterators into a single iterator. The returned iterator
1060 iterates across the elements of each iterator in <code>inputs</code>. The input
1061 iterators are not polled until necessary.
1062
1063 <p>The returned iterator supports <code>remove()</code> when the corresponding
1064 input iterator supports it.
1065<P>
1066<DD><DL>
1067
1068<DT><B>Throws:</B>
1069<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>
1070</DD>
1071</DL>
1072<HR>
1073
1074<A NAME="concat(java.util.Iterator)"><!-- --></A><H3>
1075concat</H3>
1076<PRE>
1077public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;? 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>&lt;? extends T&gt;&gt;&nbsp;inputs)</PRE>
1078<DL>
1079<DD>Combines multiple iterators into a single iterator. The returned iterator
1080 iterates across the elements of each iterator in <code>inputs</code>. The input
1081 iterators are not polled until necessary.
1082
1083 <p>The returned iterator supports <code>remove()</code> when the corresponding
1084 input iterator supports it. The methods of the returned iterator may throw
1085 <code>NullPointerException</code> if any of the input iterators are null.
1086<P>
1087<DD><DL>
1088</DL>
1089</DD>
1090</DL>
1091<HR>
1092
1093<A NAME="partition(java.util.Iterator, int)"><!-- --></A><H3>
1094partition</H3>
1095<PRE>
1096public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;<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>&lt;T&gt;&gt; <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>&lt;T&gt;&nbsp;iterator,
1097                                                          int&nbsp;size)</PRE>
1098<DL>
1099<DD>Divides an iterator into unmodifiable sublists of the given size (the final
1100 list may be smaller). For example, partitioning an iterator containing
1101 <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
1102 three and two elements, all in the original order.
1103
1104 <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>.
1105<P>
1106<DD><DL>
1107<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)
1108<DT><B>Returns:</B><DD>an iterator of immutable lists containing the elements of <code>iterator</code> divided into partitions
1109<DT><B>Throws:</B>
1110<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>
1111</DD>
1112</DL>
1113<HR>
1114
1115<A NAME="paddedPartition(java.util.Iterator, int)"><!-- --></A><H3>
1116paddedPartition</H3>
1117<PRE>
1118public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;<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>&lt;T&gt;&gt; <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>&lt;T&gt;&nbsp;iterator,
1119                                                                int&nbsp;size)</PRE>
1120<DL>
1121<DD>Divides an iterator into unmodifiable sublists of the given size, padding
1122 the final iterator with null values if necessary. For example, partitioning
1123 an iterator containing <code>[a, b, c, d, e]</code> with a partition size of 3
1124 yields <code>[[a, b, c], [d, e, null]]</code> -- an outer iterator containing
1125 two inner lists of three elements each, all in the original order.
1126
1127 <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>.
1128<P>
1129<DD><DL>
1130<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
1131<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
1132     trailing null elements)
1133<DT><B>Throws:</B>
1134<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>
1135</DD>
1136</DL>
1137<HR>
1138
1139<A NAME="filter(java.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3>
1140filter</H3>
1141<PRE>
1142public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <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>&lt;T&gt;&nbsp;unfiltered,
1143                                                 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</PRE>
1144<DL>
1145<DD>Returns the elements of <code>unfiltered</code> that satisfy a predicate.
1146<P>
1147<DD><DL>
1148</DL>
1149</DD>
1150</DL>
1151<HR>
1152
1153<A NAME="filter(java.util.Iterator, java.lang.Class)"><!-- --></A><H3>
1154filter</H3>
1155<PRE>
1156public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <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>&lt;?&gt;&nbsp;unfiltered,
1157                                                 <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>&lt;T&gt;&nbsp;type)</PRE>
1158<DL>
1159<DD>Returns all instances of class <code>type</code> in <code>unfiltered</code>. The
1160 returned iterator has elements whose class is <code>type</code> or a subclass of
1161 <code>type</code>.
1162<P>
1163<DD><DL>
1164<DT><B>Parameters:</B><DD><CODE>unfiltered</CODE> - an iterator containing objects of any type<DD><CODE>type</CODE> - the type of elements desired
1165<DT><B>Returns:</B><DD>an unmodifiable iterator containing all elements of the original
1166     iterator that were of the requested type</DL>
1167</DD>
1168</DL>
1169<HR>
1170
1171<A NAME="any(java.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3>
1172any</H3>
1173<PRE>
1174public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator,
1175                              <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</PRE>
1176<DL>
1177<DD>Returns <code>true</code> if one or more elements returned by <code>iterator</code>
1178 satisfy the given predicate.
1179<P>
1180<DD><DL>
1181</DL>
1182</DD>
1183</DL>
1184<HR>
1185
1186<A NAME="all(java.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3>
1187all</H3>
1188<PRE>
1189public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator,
1190                              <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</PRE>
1191<DL>
1192<DD>Returns <code>true</code> if every element returned by <code>iterator</code>
1193 satisfies the given predicate. If <code>iterator</code> is empty, <code>true</code>
1194 is returned.
1195<P>
1196<DD><DL>
1197</DL>
1198</DD>
1199</DL>
1200<HR>
1201
1202<A NAME="find(java.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3>
1203find</H3>
1204<PRE>
1205public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator,
1206                         <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</PRE>
1207<DL>
1208<DD>Returns the first element in <code>iterator</code> that satisfies the given
1209 predicate. If a matching element is found, the iterator will be left in a
1210 state such that calling <code>iterator.remove()</code> will remove the found
1211 item. If no such element is found, the iterator will be left exhausted: its
1212 <code>hasNext()</code> method will return <code>false</code>.
1213<P>
1214<DD><DL>
1215
1216<DT><B>Returns:</B><DD>the first matching element in <code>iterator</code>
1217<DT><B>Throws:</B>
1218<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
1219     the given predicate</DL>
1220</DD>
1221</DL>
1222<HR>
1223
1224<A NAME="indexOf(java.util.Iterator, com.google.common.base.Predicate)"><!-- --></A><H3>
1225indexOf</H3>
1226<PRE>
1227public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator,
1228                              <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super T&gt;&nbsp;predicate)</PRE>
1229<DL>
1230<DD>Returns the index in <code>iterator</code> of the first element that satisfies
1231 the provided <code>predicate</code>, or <code>-1</code> if the Iterator has no such
1232 elements.
1233
1234 <p>More formally, returns the lowest index <code>i</code> such that
1235 <code>predicate.apply(Iterators.get(iterator, i))</code> is <code>true</code>, or
1236 <code>-1</code> if there is no such index.
1237
1238 <p>If -1 is returned, the iterator will be left exhausted: its
1239 <code>hasNext()</code> method will return <code>false</code>.  Otherwise,
1240 the iterator will be set to the element which satisfies the
1241 <code>predicate</code>.
1242<P>
1243<DD><DL>
1244<DT><B>Since:</B></DT>
1245  <DD>2010.01.04 <b>tentative</b></DD>
1246</DL>
1247</DD>
1248</DL>
1249<HR>
1250
1251<A NAME="transform(java.util.Iterator, com.google.common.base.Function)"><!-- --></A><H3>
1252transform</H3>
1253<PRE>
1254public static &lt;F,T&gt; <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>&lt;T&gt; <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>&lt;F&gt;&nbsp;fromIterator,
1255                                          <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super F,? extends T&gt;&nbsp;function)</PRE>
1256<DL>
1257<DD>Returns an iterator that applies <code>function</code> to each element of <code>fromIterator</code>.
1258
1259 <p>The returned iterator supports <code>remove()</code> if the provided iterator
1260 does. After a successful <code>remove()</code> call, <code>fromIterator</code> no
1261 longer contains the corresponding element.
1262<P>
1263<DD><DL>
1264</DL>
1265</DD>
1266</DL>
1267<HR>
1268
1269<A NAME="get(java.util.Iterator, int)"><!-- --></A><H3>
1270get</H3>
1271<PRE>
1272public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator,
1273                        int&nbsp;position)</PRE>
1274<DL>
1275<DD>Advances <code>iterator</code> <code>position + 1</code> times, returning the element
1276 at the <code>position</code>th position.
1277<P>
1278<DD><DL>
1279<DT><B>Parameters:</B><DD><CODE>position</CODE> - position of the element to return
1280<DT><B>Returns:</B><DD>the element at the specified position in <code>iterator</code>
1281<DT><B>Throws:</B>
1282<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
1283     greater than or equal to the number of elements remaining in
1284     <code>iterator</code></DL>
1285</DD>
1286</DL>
1287<HR>
1288
1289<A NAME="getLast(java.util.Iterator)"><!-- --></A><H3>
1290getLast</H3>
1291<PRE>
1292public static &lt;T&gt; 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>&lt;T&gt;&nbsp;iterator)</PRE>
1293<DL>
1294<DD>Advances <code>iterator</code> to the end, returning the last element.
1295<P>
1296<DD><DL>
1297
1298<DT><B>Returns:</B><DD>the last element of <code>iterator</code>
1299<DT><B>Throws:</B>
1300<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>
1301</DD>
1302</DL>
1303<HR>
1304
1305<A NAME="consumingIterator(java.util.Iterator)"><!-- --></A><H3>
1306consumingIterator</H3>
1307<PRE>
1308public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;T&gt;&nbsp;iterator)</PRE>
1309<DL>
1310<DD>Returns a view of the supplied <code>iterator</code> that removes each element
1311 from the supplied <code>iterator</code> as it is returned.
1312
1313 <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
1314 else the returned iterator will fail on the first call to <code>next</code>.
1315<P>
1316<DD><DL>
1317<DT><B>Parameters:</B><DD><CODE>iterator</CODE> - the iterator to remove and return elements from
1318<DT><B>Returns:</B><DD>an iterator that removes and returns elements from the
1319     supplied iterator<DT><B>Since:</B></DT>
1320  <DD>2010.01.04 <b>tentative</b></DD>
1321</DL>
1322</DD>
1323</DL>
1324<HR>
1325
1326<A NAME="forArray(java.lang.Object[])"><!-- --></A><A NAME="forArray(T...)"><!-- --></A><H3>
1327forArray</H3>
1328<PRE>
1329public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <B>forArray</B>(T...&nbsp;array)</PRE>
1330<DL>
1331<DD>Returns an iterator containing the elements of <code>array</code> in order. The
1332 returned iterator is a view of the array; subsequent changes to the array
1333 will be reflected in the iterator.
1334
1335 <p><b>Note:</b> It is often preferable to represent your data using a
1336 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
1337 this method unnecessary.
1338
1339 <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>}.
1340<P>
1341<DD><DL>
1342</DL>
1343</DD>
1344</DL>
1345<HR>
1346
1347<A NAME="singletonIterator(java.lang.Object)"><!-- --></A><A NAME="singletonIterator(T)"><!-- --></A><H3>
1348singletonIterator</H3>
1349<PRE>
1350public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <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>
1351                                                            T&nbsp;value)</PRE>
1352<DL>
1353<DD>Returns an iterator containing only <code>value</code>.
1354
1355 <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>.
1356<P>
1357<DD><DL>
1358</DL>
1359</DD>
1360</DL>
1361<HR>
1362
1363<A NAME="forEnumeration(java.util.Enumeration)"><!-- --></A><H3>
1364forEnumeration</H3>
1365<PRE>
1366public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/UnmodifiableIterator.html" title="class in com.google.common.collect">UnmodifiableIterator</A>&lt;T&gt; <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>&lt;T&gt;&nbsp;enumeration)</PRE>
1367<DL>
1368<DD>Adapts an <code>Enumeration</code> to the <code>Iterator</code> interface.
1369
1370 <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
1371 <code>Enumeration</code> as an <code>Iterable</code> is impossible. However, the
1372 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>.
1373<P>
1374<DD><DL>
1375</DL>
1376</DD>
1377</DL>
1378<HR>
1379
1380<A NAME="asEnumeration(java.util.Iterator)"><!-- --></A><H3>
1381asEnumeration</H3>
1382<PRE>
1383public static &lt;T&gt; <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>&lt;T&gt; <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>&lt;T&gt;&nbsp;iterator)</PRE>
1384<DL>
1385<DD>Adapts an <code>Iterator</code> to the <code>Enumeration</code> interface.
1386
1387 <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
1388 <code>Iterators.asEnumeration(collection.iterator())</code>.
1389<P>
1390<DD><DL>
1391</DL>
1392</DD>
1393</DL>
1394<HR>
1395
1396<A NAME="peekingIterator(java.util.Iterator)"><!-- --></A><H3>
1397peekingIterator</H3>
1398<PRE>
1399public static &lt;T&gt; <A HREF="../../../../com/google/common/collect/PeekingIterator.html" title="interface in com.google.common.collect">PeekingIterator</A>&lt;T&gt; <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>&lt;? extends T&gt;&nbsp;iterator)</PRE>
1400<DL>
1401<DD>Returns a <code>PeekingIterator</code> backed by the given iterator.
1402
1403 <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
1404 time. A subsequent call to <code>next</code> is guaranteed to return the same
1405 object again. For example: <pre>   <code>PeekingIterator&lt;String&gt; peekingIterator =
1406       Iterators.peekingIterator(Iterators.forArray("a", "b"));
1407   String a1 = peekingIterator.peek(); // returns "a"
1408   String a2 = peekingIterator.peek(); // also returns "a"
1409   String a3 = peekingIterator.next(); // also returns "a"</code></pre>
1410
1411 Any structural changes to the underlying iteration (aside from those
1412 performed by the iterator's own <A HREF="../../../../com/google/common/collect/PeekingIterator.html#remove()"><CODE>PeekingIterator.remove()</CODE></A> method)
1413 will leave the iterator in an undefined state.
1414
1415 <p>The returned iterator does not support removal after peeking, as
1416 explained by <A HREF="../../../../com/google/common/collect/PeekingIterator.html#remove()"><CODE>PeekingIterator.remove()</CODE></A>.
1417
1418 <p>Note: If the given iterator is already a <code>PeekingIterator</code>,
1419 it <i>might</i> be returned to the caller, although this is neither
1420 guaranteed to occur nor required to be consistent.  For example, this
1421 method <i>might</i> choose to pass through recognized implementations of
1422 <code>PeekingIterator</code> when the behavior of the implementation is
1423 known to meet the contract guaranteed by this method.
1424
1425 <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
1426 method to wrap each individual iterator as it is generated.
1427<P>
1428<DD><DL>
1429<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
1430     ownership of this iterator, so users should cease making direct calls
1431     to it after calling this method.
1432<DT><B>Returns:</B><DD>a peeking iterator backed by that iterator. Apart from the
1433     additional <A HREF="../../../../com/google/common/collect/PeekingIterator.html#peek()"><CODE>PeekingIterator.peek()</CODE></A> method, this iterator behaves
1434     exactly the same as <code>iterator</code>.</DL>
1435</DD>
1436</DL>
1437<!-- ========= END OF CLASS DATA ========= -->
1438<HR>
1439
1440
1441<!-- ======= START OF BOTTOM NAVBAR ====== -->
1442<A NAME="navbar_bottom"><!-- --></A>
1443<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
1444<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
1445<TR>
1446<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
1447<A NAME="navbar_bottom_firstrow"><!-- --></A>
1448<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
1449  <TR ALIGN="center" VALIGN="top">
1450  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
1451  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
1452  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
1453  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Iterators.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
1454  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
1455  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
1456  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
1457  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
1458  </TR>
1459</TABLE>
1460</TD>
1461<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
1462</EM>
1463</TD>
1464</TR>
1465
1466<TR>
1467<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
1468&nbsp;<A HREF="../../../../com/google/common/collect/Iterables.html" title="class in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
1469&nbsp;<A HREF="../../../../com/google/common/collect/LinkedHashMultimap.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
1470<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
1471  <A HREF="../../../../index.html?com/google/common/collect/Iterators.html" target="_top"><B>FRAMES</B></A>  &nbsp;
1472&nbsp;<A HREF="Iterators.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
1473&nbsp;<SCRIPT type="text/javascript">
1474  <!--
1475  if(window==top) {
1476    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
1477  }
1478  //-->
1479</SCRIPT>
1480<NOSCRIPT>
1481  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
1482</NOSCRIPT>
1483
1484
1485</FONT></TD>
1486</TR>
1487<TR>
1488<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
1489  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
1490<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
1491DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
1492</TR>
1493</TABLE>
1494<A NAME="skip-navbar_bottom"></A>
1495<!-- ======== END OF BOTTOM NAVBAR ======= -->
1496
1497<HR>
1498
1499</BODY>
1500</HTML>
1501