1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <!-- Generated by javadoc (build 1.5.0_06) on Wed Aug 20 17:16:43 PDT 2008 -->
7 Objects (Google Collections Library - snapshot-
20080820 (ALPHA))
10 <META NAME=
"keywords" CONTENT=
"com.google.common.base.Objects class">
12 <LINK REL =
"stylesheet" TYPE=
"text/css" HREF=
"../../../../stylesheet.css" TITLE=
"Style">
14 <SCRIPT type=
"text/javascript">
15 function windowTitle()
17 parent.document.
title=
"Objects (Google Collections Library - snapshot-20080820 (ALPHA))";
25 <BODY BGCOLOR=
"white" onload=
"windowTitle();">
28 <!-- ========= START OF TOP NAVBAR ======= -->
29 <A NAME=
"navbar_top"><!-- --></A>
30 <A HREF=
"#skip-navbar_top" title=
"Skip navigation links"></A>
31 <TABLE BORDER=
"0" WIDTH=
"100%" CELLPADDING=
"1" CELLSPACING=
"0" SUMMARY=
"">
33 <TD COLSPAN=
2 BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1">
34 <A NAME=
"navbar_top_firstrow"><!-- --></A>
35 <TABLE BORDER=
"0" CELLPADDING=
"0" CELLSPACING=
"3" SUMMARY=
"">
36 <TR ALIGN=
"center" VALIGN=
"top">
37 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../overview-summary.html"><FONT CLASS=
"NavBarFont1"><B>Overview
</B></FONT></A> </TD>
38 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-summary.html"><FONT CLASS=
"NavBarFont1"><B>Package
</B></FONT></A> </TD>
39 <TD BGCOLOR=
"#FFFFFF" CLASS=
"NavBarCell1Rev"> <FONT CLASS=
"NavBarFont1Rev"><B>Class
</B></FONT> </TD>
40 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-tree.html"><FONT CLASS=
"NavBarFont1"><B>Tree
</B></FONT></A> </TD>
41 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../deprecated-list.html"><FONT CLASS=
"NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
42 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../index-all.html"><FONT CLASS=
"NavBarFont1"><B>Index
</B></FONT></A> </TD>
43 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../help-doc.html"><FONT CLASS=
"NavBarFont1"><B>Help
</B></FONT></A> </TD>
47 <TD ALIGN=
"right" VALIGN=
"top" ROWSPAN=
3><EM>
53 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
54 <A HREF=
"../../../../com/google/common/base/Nullable.html" title=
"annotation in com.google.common.base"><B>PREV CLASS
</B></A>
55 <A HREF=
"../../../../com/google/common/base/Preconditions.html" title=
"class in com.google.common.base"><B>NEXT CLASS
</B></A></FONT></TD>
56 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
57 <A HREF=
"../../../../index.html?com/google/common/base/Objects.html" target=
"_top"><B>FRAMES
</B></A>
58 <A HREF=
"Objects.html" target=
"_top"><B>NO FRAMES
</B></A>
59 <SCRIPT type=
"text/javascript">
62 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67 <A HREF=
"../../../../allclasses-noframe.html"><B>All Classes
</B></A>
74 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
75 SUMMARY:
NESTED
|
FIELD
|
CONSTR
|
<A HREF=
"#method_summary">METHOD
</A></FONT></TD>
76 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
77 DETAIL:
FIELD
|
CONSTR
|
<A HREF=
"#method_detail">METHOD
</A></FONT></TD>
80 <A NAME=
"skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
84 <!-- ======== START OF CLASS DATA ======== -->
87 com.google.common.base
</FONT>
91 <A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">java.lang.Object
</A>
92 <IMG SRC=
"../../../../resources/inherit.gif" ALT=
"extended by "><B>com.google.common.base.Objects
</B>
96 <DT><PRE>public final class
<B>Objects
</B><DT>extends
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A></DL>
100 Helper functions that can operate on any
<code>Object
</code>.
105 <DT><B>Author:
</B></DT>
106 <DD>Laurence Gonsalves
</DD>
112 <!-- ========== METHOD SUMMARY =========== -->
114 <A NAME=
"method_summary"><!-- --></A>
115 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
116 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
117 <TH ALIGN=
"left" COLSPAN=
"2"><FONT SIZE=
"+2">
118 <B>Method Summary
</B></FONT></TH>
120 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
121 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
122 <CODE>static
boolean
</CODE></FONT></TD>
123 <TD><CODE><B><A HREF=
"../../../../com/google/common/base/Objects.html#equal(java.lang.Object, java.lang.Object)">equal
</A></B>(
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A> a,
124 <A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A> b)
</CODE>
127 Determines whether two possibly-null objects are equal.
</TD>
129 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
130 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
132 <TABLE BORDER=
"0" CELLPADDING=
"0" CELLSPACING=
"0" SUMMARY=
"">
133 <TR ALIGN=
"right" VALIGN=
"">
134 <TD NOWRAP
><FONT SIZE=
"-1">
135 <CODE><T
> T
</CODE></FONT></TD>
139 <TD><CODE><B><A HREF=
"../../../../com/google/common/base/Objects.html#firstNonNull(T, T)">firstNonNull
</A></B>(T
first,
140 T
second)
</CODE>
143 Returns the first of two given parameters that is not
<code>null
</code>, if
144 either is, or otherwise throws a
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html" title=
"class or interface in java.lang"><CODE>NullPointerException
</CODE></A>.
</TD>
146 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
147 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
148 <CODE>static
int
</CODE></FONT></TD>
149 <TD><CODE><B><A HREF=
"../../../../com/google/common/base/Objects.html#hashCode(java.lang.Object...)">hashCode
</A></B>(
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A>...
objects)
</CODE>
152 Generates a hash code for multiple values.
</TD>
155 <A NAME=
"methods_inherited_from_class_java.lang.Object"><!-- --></A>
156 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
157 <TR BGCOLOR=
"#EEEEFF" CLASS=
"TableSubHeadingColor">
158 <TH ALIGN=
"left"><B>Methods inherited from class java.lang.
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A></B></TH>
160 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
161 <TD><CODE><A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()" title=
"class or interface in java.lang">clone
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#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#finalize()" title=
"class or interface in java.lang">finalize
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()" title=
"class or interface in java.lang">getClass
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()" title=
"class or interface in java.lang">hashCode
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()" title=
"class or interface in java.lang">notify
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()" title=
"class or interface in java.lang">notifyAll
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#toString()" title=
"class or interface in java.lang">toString
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()" title=
"class or interface in java.lang">wait
</A>,
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#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#wait(long, int)" title=
"class or interface in java.lang">wait
</A></CODE></TD>
167 <!-- ============ METHOD DETAIL ========== -->
169 <A NAME=
"method_detail"><!-- --></A>
170 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
171 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
172 <TH ALIGN=
"left" COLSPAN=
"1"><FONT SIZE=
"+2">
173 <B>Method Detail
</B></FONT></TH>
177 <A NAME=
"equal(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
180 public static boolean
<B>equal
</B>(
<FONT SIZE=
"-1"><A HREF=
"../../../../com/google/common/base/Nullable.html" title=
"annotation in com.google.common.base">@Nullable
</A></FONT>
181 <A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A> a,
182 <FONT SIZE=
"-1"><A HREF=
"../../../../com/google/common/base/Nullable.html" title=
"annotation in com.google.common.base">@Nullable
</A></FONT>
183 <A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A> b)
</PRE>
185 <DD>Determines whether two possibly-null objects are equal. Returns:
188 <li><code>true
</code> if
<code>a
</code> and
<code>b
</code> are both null.
189 <li><code>true
</code> if
<code>a
</code> and
<code>b
</code> are both non-null and they are
190 equal according to
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)" title=
"class or interface in java.lang"><CODE>Object.equals(Object)
</CODE></A>.
191 <li><code>false
</code> in all other situations.
194 <p>This assumes that any non-null objects passed to this function conform
195 to the
<code>equals()
</code> contract.
203 <A NAME=
"hashCode(java.lang.Object...)"><!-- --></A><H3>
206 public static int
<B>hashCode
</B>(
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title=
"class or interface in java.lang">Object
</A>...
objects)
</PRE>
208 <DD>Generates a hash code for multiple values. The hash code is generated by
209 calling
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#hashCode(java.lang.Object[])" title=
"class or interface in java.util"><CODE>Arrays.hashCode(Object[])
</CODE></A>.
211 <p>This is useful for implementing
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()" title=
"class or interface in java.lang"><CODE>Object.hashCode()
</CODE></A>. For example,
212 in an object that has three properties,
<code>x
</code>,
<code>y
</code>, and
213 <code>z
</code>, one could write:
215 public int hashCode() {
216 return Objects.hashCode(getX(), getY(), getZ());
219 <b>Warning
</b>: When a single object is supplied, the returned hash code
220 does not equal the hash code of that object.
228 <A NAME=
"firstNonNull(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME=
"firstNonNull(T, T)"><!-- --></A><H3>
231 public static
<T
> T
<B>firstNonNull
</B>(
<FONT SIZE=
"-1"><A HREF=
"../../../../com/google/common/base/Nullable.html" title=
"annotation in com.google.common.base">@Nullable
</A></FONT>
233 <FONT SIZE=
"-1"><A HREF=
"../../../../com/google/common/base/Nullable.html" title=
"annotation in com.google.common.base">@Nullable
</A></FONT>
236 <DD>Returns the first of two given parameters that is not
<code>null
</code>, if
237 either is, or otherwise throws a
<A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html" title=
"class or interface in java.lang"><CODE>NullPointerException
</CODE></A>.
241 <DT><B>Returns:
</B><DD><code>first
</code> if
<code>first
</code> is not
<code>null
</code>, or
242 <code>second
</code> if
<code>first
</code> is
<code>null
</code> and
<code>second
</code> is
243 not
<code>null
</code>
245 <DD><CODE><A HREF=
"http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html" title=
"class or interface in java.lang">NullPointerException
</A></CODE> - if both
<code>first
</code> and
<code>second
</code> were
246 <code>null
</code></DL>
249 <!-- ========= END OF CLASS DATA ========= -->
253 <!-- ======= START OF BOTTOM NAVBAR ====== -->
254 <A NAME=
"navbar_bottom"><!-- --></A>
255 <A HREF=
"#skip-navbar_bottom" title=
"Skip navigation links"></A>
256 <TABLE BORDER=
"0" WIDTH=
"100%" CELLPADDING=
"1" CELLSPACING=
"0" SUMMARY=
"">
258 <TD COLSPAN=
2 BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1">
259 <A NAME=
"navbar_bottom_firstrow"><!-- --></A>
260 <TABLE BORDER=
"0" CELLPADDING=
"0" CELLSPACING=
"3" SUMMARY=
"">
261 <TR ALIGN=
"center" VALIGN=
"top">
262 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../overview-summary.html"><FONT CLASS=
"NavBarFont1"><B>Overview
</B></FONT></A> </TD>
263 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-summary.html"><FONT CLASS=
"NavBarFont1"><B>Package
</B></FONT></A> </TD>
264 <TD BGCOLOR=
"#FFFFFF" CLASS=
"NavBarCell1Rev"> <FONT CLASS=
"NavBarFont1Rev"><B>Class
</B></FONT> </TD>
265 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-tree.html"><FONT CLASS=
"NavBarFont1"><B>Tree
</B></FONT></A> </TD>
266 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../deprecated-list.html"><FONT CLASS=
"NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
267 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../index-all.html"><FONT CLASS=
"NavBarFont1"><B>Index
</B></FONT></A> </TD>
268 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../help-doc.html"><FONT CLASS=
"NavBarFont1"><B>Help
</B></FONT></A> </TD>
272 <TD ALIGN=
"right" VALIGN=
"top" ROWSPAN=
3><EM>
278 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
279 <A HREF=
"../../../../com/google/common/base/Nullable.html" title=
"annotation in com.google.common.base"><B>PREV CLASS
</B></A>
280 <A HREF=
"../../../../com/google/common/base/Preconditions.html" title=
"class in com.google.common.base"><B>NEXT CLASS
</B></A></FONT></TD>
281 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
282 <A HREF=
"../../../../index.html?com/google/common/base/Objects.html" target=
"_top"><B>FRAMES
</B></A>
283 <A HREF=
"Objects.html" target=
"_top"><B>NO FRAMES
</B></A>
284 <SCRIPT type=
"text/javascript">
287 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
292 <A HREF=
"../../../../allclasses-noframe.html"><B>All Classes
</B></A>
299 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
300 SUMMARY:
NESTED
|
FIELD
|
CONSTR
|
<A HREF=
"#method_summary">METHOD
</A></FONT></TD>
301 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
302 DETAIL:
FIELD
|
CONSTR
|
<A HREF=
"#method_detail">METHOD
</A></FONT></TD>
305 <A NAME=
"skip-navbar_bottom"></A>
306 <!-- ======== END OF BOTTOM NAVBAR ======= -->