• 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>
7Booleans (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="Booleans (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/Booleans.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;PREV CLASS&nbsp;
59&nbsp;<A HREF="../../../../com/google/common/primitives/Bytes.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../index.html?com/google/common/primitives/Booleans.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Booleans.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.primitives</FONT>
92<BR>
93Class Booleans</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.primitives.Booleans</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public final class <B>Booleans</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>
104Static utility methods pertaining to <code>boolean</code> primitives, that are not
105 already found in either <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang"><CODE>Boolean</CODE></A> or <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true" title="class or interface in java.util"><CODE>Arrays</CODE></A>.
106<P>
107
108<P>
109<DL>
110<DT><B>Since:</B></DT>
111  <DD>2009.09.15 <b>tentative</b></DD>
112<DT><B>Author:</B></DT>
113  <DD>Kevin Bourrillion</DD>
114</DL>
115<HR>
116
117<P>
118
119<!-- ========== METHOD SUMMARY =========== -->
120
121<A NAME="method_summary"><!-- --></A>
122<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
123<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
124<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
125<B>Method Summary</B></FONT></TH>
126</TR>
127<TR BGCOLOR="white" CLASS="TableRowColor">
128<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
129<CODE>static&nbsp;<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;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</A>&gt;</CODE></FONT></TD>
130<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#asList(boolean...)">asList</A></B>(boolean...&nbsp;backingArray)</CODE>
131
132<BR>
133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a fixed-size list backed by the specified array, similar to <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>.</TD>
134</TR>
135<TR BGCOLOR="white" CLASS="TableRowColor">
136<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
137<CODE>static&nbsp;int</CODE></FONT></TD>
138<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#compare(boolean, boolean)">compare</A></B>(boolean&nbsp;a,
139        boolean&nbsp;b)</CODE>
140
141<BR>
142&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares the two specified <code>boolean</code> values in the standard way
143 (<code>false</code> is considered less than <code>true</code>).</TD>
144</TR>
145<TR BGCOLOR="white" CLASS="TableRowColor">
146<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
147<CODE>static&nbsp;boolean[]</CODE></FONT></TD>
148<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#concat(boolean[]...)">concat</A></B>(boolean[]...&nbsp;arrays)</CODE>
149
150<BR>
151&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the values from each provided array combined into a single array.</TD>
152</TR>
153<TR BGCOLOR="white" CLASS="TableRowColor">
154<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
155<CODE>static&nbsp;boolean</CODE></FONT></TD>
156<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#contains(boolean[], boolean)">contains</A></B>(boolean[]&nbsp;array,
157         boolean&nbsp;target)</CODE>
158
159<BR>
160&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if <code>target</code> is present as an element anywhere in
161 <code>array</code>.</TD>
162</TR>
163<TR BGCOLOR="white" CLASS="TableRowColor">
164<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
165<CODE>static&nbsp;boolean[]</CODE></FONT></TD>
166<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#ensureCapacity(boolean[], int, int)">ensureCapacity</A></B>(boolean[]&nbsp;array,
167               int&nbsp;minLength,
168               int&nbsp;padding)</CODE>
169
170<BR>
171&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an array containing the same values as <code>array</code>, but
172 guaranteed to be of a specified minimum length.</TD>
173</TR>
174<TR BGCOLOR="white" CLASS="TableRowColor">
175<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
176<CODE>static&nbsp;int</CODE></FONT></TD>
177<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#hashCode(boolean)">hashCode</A></B>(boolean&nbsp;value)</CODE>
178
179<BR>
180&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a hash code for <code>value</code>; equal to the result of invoking
181 <code>((Boolean) value).hashCode()</code>.</TD>
182</TR>
183<TR BGCOLOR="white" CLASS="TableRowColor">
184<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
185<CODE>static&nbsp;int</CODE></FONT></TD>
186<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#indexOf(boolean[], boolean)">indexOf</A></B>(boolean[]&nbsp;array,
187        boolean&nbsp;target)</CODE>
188
189<BR>
190&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index of the first appearance of the value <code>target</code> in
191 <code>array</code>.</TD>
192</TR>
193<TR BGCOLOR="white" CLASS="TableRowColor">
194<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
195<CODE>static&nbsp;int</CODE></FONT></TD>
196<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#indexOf(boolean[], boolean[])">indexOf</A></B>(boolean[]&nbsp;array,
197        boolean[]&nbsp;target)</CODE>
198
199<BR>
200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.</TD>
201</TR>
202<TR BGCOLOR="white" CLASS="TableRowColor">
203<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
204<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>
205<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#join(java.lang.String, boolean...)">join</A></B>(<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>&nbsp;separator,
206     boolean...&nbsp;array)</CODE>
207
208<BR>
209&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a string containing the supplied <code>boolean</code> values separated
210 by <code>separator</code>.</TD>
211</TR>
212<TR BGCOLOR="white" CLASS="TableRowColor">
213<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
214<CODE>static&nbsp;int</CODE></FONT></TD>
215<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#lastIndexOf(boolean[], boolean)">lastIndexOf</A></B>(boolean[]&nbsp;array,
216            boolean&nbsp;target)</CODE>
217
218<BR>
219&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index of the last appearance of the value <code>target</code> in
220 <code>array</code>.</TD>
221</TR>
222<TR BGCOLOR="white" CLASS="TableRowColor">
223<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
224<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;boolean[]&gt;</CODE></FONT></TD>
225<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#lexicographicalComparator()">lexicographicalComparator</A></B>()</CODE>
226
227<BR>
228&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a comparator that compares two <code>boolean</code> arrays
229 lexicographically.</TD>
230</TR>
231<TR BGCOLOR="white" CLASS="TableRowColor">
232<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
233<CODE>static&nbsp;boolean[]</CODE></FONT></TD>
234<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Booleans.html#toArray(java.util.Collection)">toArray</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;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</A>&gt;&nbsp;collection)</CODE>
235
236<BR>
237&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies a collection of <code>Boolean</code> instances into a new array of
238 primitive <code>boolean</code> values.</TD>
239</TR>
240</TABLE>
241&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
242<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
243<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
244<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>
245</TR>
246<TR BGCOLOR="white" CLASS="TableRowColor">
247<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>
248</TR>
249</TABLE>
250&nbsp;
251<P>
252
253<!-- ============ METHOD DETAIL ========== -->
254
255<A NAME="method_detail"><!-- --></A>
256<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
257<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
258<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
259<B>Method Detail</B></FONT></TH>
260</TR>
261</TABLE>
262
263<A NAME="hashCode(boolean)"><!-- --></A><H3>
264hashCode</H3>
265<PRE>
266public static int <B>hashCode</B>(boolean&nbsp;value)</PRE>
267<DL>
268<DD>Returns a hash code for <code>value</code>; equal to the result of invoking
269 <code>((Boolean) value).hashCode()</code>.
270<P>
271<DD><DL>
272<DT><B>Parameters:</B><DD><CODE>value</CODE> - a primitive <code>boolean</code> value
273<DT><B>Returns:</B><DD>a hash code for the value</DL>
274</DD>
275</DL>
276<HR>
277
278<A NAME="compare(boolean, boolean)"><!-- --></A><H3>
279compare</H3>
280<PRE>
281public static int <B>compare</B>(boolean&nbsp;a,
282                          boolean&nbsp;b)</PRE>
283<DL>
284<DD>Compares the two specified <code>boolean</code> values in the standard way
285 (<code>false</code> is considered less than <code>true</code>). The sign of the
286 value returned is the same as that of <code>((Boolean) a).compareTo(b)</code>.
287<P>
288<DD><DL>
289<DT><B>Parameters:</B><DD><CODE>a</CODE> - the first <code>boolean</code> to compare<DD><CODE>b</CODE> - the second <code>boolean</code> to compare
290<DT><B>Returns:</B><DD>a positive number if only <code>a</code> is <code>true</code>,  a negative
291     number if only <code>b</code> is true, or zero if <code>a == b</code></DL>
292</DD>
293</DL>
294<HR>
295
296<A NAME="contains(boolean[], boolean)"><!-- --></A><H3>
297contains</H3>
298<PRE>
299public static boolean <B>contains</B>(boolean[]&nbsp;array,
300                               boolean&nbsp;target)</PRE>
301<DL>
302<DD>Returns <code>true</code> if <code>target</code> is present as an element anywhere in
303 <code>array</code>.
304
305 <p><b>Note:</b> consider representing the array as a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/BitSet.html?is-external=true" title="class or interface in java.util"><CODE>BitSet</CODE></A> instead, replacing <code>Booleans.contains(array, true)</code>
306 with <code>!bitSet.isEmpty()</code> and <code>Booleans.contains(array, false)</code>
307 with <code>bitSet.nextClearBit(0) == sizeOfBitSet</code>.
308<P>
309<DD><DL>
310<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>boolean</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>boolean</code> value
311<DT><B>Returns:</B><DD><code>true</code> if <code>array[i] == target</code> for some value of <code>i</code></DL>
312</DD>
313</DL>
314<HR>
315
316<A NAME="indexOf(boolean[], boolean)"><!-- --></A><H3>
317indexOf</H3>
318<PRE>
319public static int <B>indexOf</B>(boolean[]&nbsp;array,
320                          boolean&nbsp;target)</PRE>
321<DL>
322<DD>Returns the index of the first appearance of the value <code>target</code> in
323 <code>array</code>.
324
325 <p><b>Note:</b> consider representing the array as a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/BitSet.html?is-external=true" title="class or interface in java.util"><CODE>BitSet</CODE></A>
326 instead, and using <A HREF="http://java.sun.com/javase/6/docs/api/java/util/BitSet.html?is-external=true#nextSetBit(int)" title="class or interface in java.util"><CODE>BitSet.nextSetBit(int)</CODE></A> or <A HREF="http://java.sun.com/javase/6/docs/api/java/util/BitSet.html?is-external=true#nextClearBit(int)" title="class or interface in java.util"><CODE>BitSet.nextClearBit(int)</CODE></A>.
327<P>
328<DD><DL>
329<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>boolean</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>boolean</code> value
330<DT><B>Returns:</B><DD>the least index <code>i</code> for which <code>array[i] == target</code>, or
331     <code>-1</code> if no such index exists.</DL>
332</DD>
333</DL>
334<HR>
335
336<A NAME="indexOf(boolean[], boolean[])"><!-- --></A><H3>
337indexOf</H3>
338<PRE>
339public static int <B>indexOf</B>(boolean[]&nbsp;array,
340                          boolean[]&nbsp;target)</PRE>
341<DL>
342<DD>Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.
343
344 <p>More formally, returns the lowest index <code>i</code> such that <code>java.util.Arrays.copyOfRange(array, i, i + target.length)</code> contains exactly
345 the same elements as <code>target</code>.
346<P>
347<DD><DL>
348<DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to search for the sequence <code>target</code><DD><CODE>target</CODE> - the array to search for as a sub-sequence of <code>array</code></DL>
349</DD>
350</DL>
351<HR>
352
353<A NAME="lastIndexOf(boolean[], boolean)"><!-- --></A><H3>
354lastIndexOf</H3>
355<PRE>
356public static int <B>lastIndexOf</B>(boolean[]&nbsp;array,
357                              boolean&nbsp;target)</PRE>
358<DL>
359<DD>Returns the index of the last appearance of the value <code>target</code> in
360 <code>array</code>.
361<P>
362<DD><DL>
363<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>boolean</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>boolean</code> value
364<DT><B>Returns:</B><DD>the greatest index <code>i</code> for which <code>array[i] == target</code>,
365     or <code>-1</code> if no such index exists.</DL>
366</DD>
367</DL>
368<HR>
369
370<A NAME="concat(boolean[]...)"><!-- --></A><H3>
371concat</H3>
372<PRE>
373public static boolean[] <B>concat</B>(boolean[]...&nbsp;arrays)</PRE>
374<DL>
375<DD>Returns the values from each provided array combined into a single array.
376 For example, <code>concat(new boolean[] {a, b}, new boolean[] {}, new
377 boolean[] {c}</code> returns the array <code>{a, b, c}</code>.
378<P>
379<DD><DL>
380<DT><B>Parameters:</B><DD><CODE>arrays</CODE> - zero or more <code>boolean</code> arrays
381<DT><B>Returns:</B><DD>a single array containing all the values from the source arrays, in
382     order</DL>
383</DD>
384</DL>
385<HR>
386
387<A NAME="ensureCapacity(boolean[], int, int)"><!-- --></A><H3>
388ensureCapacity</H3>
389<PRE>
390public static boolean[] <B>ensureCapacity</B>(boolean[]&nbsp;array,
391                                       int&nbsp;minLength,
392                                       int&nbsp;padding)</PRE>
393<DL>
394<DD>Returns an array containing the same values as <code>array</code>, but
395 guaranteed to be of a specified minimum length. If <code>array</code> already
396 has a length of at least <code>minLength</code>, it is returned directly.
397 Otherwise, a new array of size <code>minLength + padding</code> is returned,
398 containing the values of <code>array</code>, and zeroes in the remaining places.
399<P>
400<DD><DL>
401<DT><B>Parameters:</B><DD><CODE>array</CODE> - the source array<DD><CODE>minLength</CODE> - the minimum length the returned array must guarantee<DD><CODE>padding</CODE> - an extra amount to "grow" the array by if growth is
402     necessary
403<DT><B>Returns:</B><DD>an array containing the values of <code>array</code>, with guaranteed
404     minimum length <code>minLength</code>
405<DT><B>Throws:</B>
406<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>minLength</code> or <code>padding</code> is
407     negative</DL>
408</DD>
409</DL>
410<HR>
411
412<A NAME="join(java.lang.String, boolean...)"><!-- --></A><H3>
413join</H3>
414<PRE>
415public 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>join</B>(<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>&nbsp;separator,
416                          boolean...&nbsp;array)</PRE>
417<DL>
418<DD>Returns a string containing the supplied <code>boolean</code> values separated
419 by <code>separator</code>. For example, <code>join("-", false, true, false)</code>
420 returns the string <code>"false-true-false"</code>.
421<P>
422<DD><DL>
423<DT><B>Parameters:</B><DD><CODE>separator</CODE> - the text that should appear between consecutive values in
424     the resulting string (but not at the start or end)<DD><CODE>array</CODE> - an array of <code>boolean</code> values, possibly empty</DL>
425</DD>
426</DL>
427<HR>
428
429<A NAME="lexicographicalComparator()"><!-- --></A><H3>
430lexicographicalComparator</H3>
431<PRE>
432public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;boolean[]&gt; <B>lexicographicalComparator</B>()</PRE>
433<DL>
434<DD>Returns a comparator that compares two <code>boolean</code> arrays
435 lexicographically. That is, it compares, using <A HREF="../../../../com/google/common/primitives/Booleans.html#compare(boolean, boolean)"><CODE>compare(boolean, boolean)</CODE></A>), the first pair of values that follow any
436 common prefix, or when one array is a prefix of the other, treats the
437 shorter array as the lesser. For example,
438 <code>[] &lt; [false] &lt; [false, true] &lt; [true]</code>.
439
440 <p>The returned comparator is inconsistent with <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"><CODE>Object.equals(Object)</CODE></A> (since arrays support only identity equality), but
441 it is consistent with <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#equals(boolean[], boolean[])" title="class or interface in java.util"><CODE>Arrays.equals(boolean[], boolean[])</CODE></A>.
442<P>
443<DD><DL>
444<DT><B>Since:</B></DT>
445  <DD>2010.01.04 <b>tentative</b></DD>
446<DT><B>See Also:</B><DD><a href="http://en.wikipedia.org/wiki/Lexicographical_order">
447     Lexicographical order</a> article at Wikipedia</DL>
448</DD>
449</DL>
450<HR>
451
452<A NAME="toArray(java.util.Collection)"><!-- --></A><H3>
453toArray</H3>
454<PRE>
455public static boolean[] <B>toArray</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;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</A>&gt;&nbsp;collection)</PRE>
456<DL>
457<DD>Copies a collection of <code>Boolean</code> instances into a new array of
458 primitive <code>boolean</code> values.
459
460 <p>Elements are copied from the argument collection as if by <code>collection.toArray()</code>.  Calling this method is as thread-safe as calling
461 that method.
462
463 <p><b>Note:</b> consider representing the collection as a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/BitSet.html?is-external=true" title="class or interface in java.util"><CODE>BitSet</CODE></A> instead.
464<P>
465<DD><DL>
466<DT><B>Parameters:</B><DD><CODE>collection</CODE> - a collection of <code>Boolean</code> objects
467<DT><B>Returns:</B><DD>an array containing the same values as <code>collection</code>, in the
468     same order, converted to primitives
469<DT><B>Throws:</B>
470<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 <code>collection</code> or any of its elements
471     is null</DL>
472</DD>
473</DL>
474<HR>
475
476<A NAME="asList(boolean...)"><!-- --></A><H3>
477asList</H3>
478<PRE>
479public static <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;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</A>&gt; <B>asList</B>(boolean...&nbsp;backingArray)</PRE>
480<DL>
481<DD>Returns a fixed-size list backed by the specified array, similar to <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>. The list supports <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true#set(int, E)" title="class or interface in java.util"><CODE>List.set(int, Object)</CODE></A>,
482 but any attempt to set a value to <code>null</code> will result in a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang"><CODE>NullPointerException</CODE></A>.
483
484 <p>The returned list maintains the values, but not the identities, of
485 <code>Boolean</code> objects written to or read from it.  For example, whether
486 <code>list.get(0) == list.get(0)</code> is true for the returned list is
487 unspecified.
488<P>
489<DD><DL>
490<DT><B>Parameters:</B><DD><CODE>backingArray</CODE> - the array to back the list
491<DT><B>Returns:</B><DD>a list view of the array</DL>
492</DD>
493</DL>
494<!-- ========= END OF CLASS DATA ========= -->
495<HR>
496
497
498<!-- ======= START OF BOTTOM NAVBAR ====== -->
499<A NAME="navbar_bottom"><!-- --></A>
500<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
501<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
502<TR>
503<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
504<A NAME="navbar_bottom_firstrow"><!-- --></A>
505<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
506  <TR ALIGN="center" VALIGN="top">
507  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
508  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
509  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
510  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Booleans.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
511  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
512  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
513  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
514  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
515  </TR>
516</TABLE>
517</TD>
518<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
519</EM>
520</TD>
521</TR>
522
523<TR>
524<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
525&nbsp;PREV CLASS&nbsp;
526&nbsp;<A HREF="../../../../com/google/common/primitives/Bytes.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD>
527<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
528  <A HREF="../../../../index.html?com/google/common/primitives/Booleans.html" target="_top"><B>FRAMES</B></A>  &nbsp;
529&nbsp;<A HREF="Booleans.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
530&nbsp;<SCRIPT type="text/javascript">
531  <!--
532  if(window==top) {
533    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
534  }
535  //-->
536</SCRIPT>
537<NOSCRIPT>
538  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
539</NOSCRIPT>
540
541
542</FONT></TD>
543</TR>
544<TR>
545<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
546  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
547<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
548DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
549</TR>
550</TABLE>
551<A NAME="skip-navbar_bottom"></A>
552<!-- ======== END OF BOTTOM NAVBAR ======= -->
553
554<HR>
555
556</BODY>
557</HTML>
558