a whole bunch of stuff
[ephemerata.git] / KezvhLib / lib / com.google.com.collect / javadoc / com / google / common / base / Objects.html
blob6e63c71b65d8a6272b77b76f3ed440a0918e9ee9
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.5.0_06) on Wed Aug 20 17:16:43 PDT 2008 -->
6 <TITLE>
7 Objects (Google Collections Library - snapshot-20080820 (ALPHA))
8 </TITLE>
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))";
19 </SCRIPT>
20 <NOSCRIPT>
21 </NOSCRIPT>
23 </HEAD>
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="">
32 <TR>
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>&nbsp;</TD>
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44 </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;<A HREF="../../../../com/google/common/base/Nullable.html" title="annotation in com.google.common.base"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<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> &nbsp;
58 &nbsp;<A HREF="Objects.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60 <!--
61 if(window==top) {
62 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
64 //-->
65 </SCRIPT>
66 <NOSCRIPT>
67 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
71 </FONT></TD>
72 </TR>
73 <TR>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78 </TR>
79 </TABLE>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
83 <HR>
84 <!-- ======== START OF CLASS DATA ======== -->
85 <H2>
86 <FONT SIZE="-1">
87 com.google.common.base</FONT>
88 <BR>
89 Class Objects</H2>
90 <PRE>
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>
93 </PRE>
94 <HR>
95 <DL>
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>
97 </PRE>
99 <P>
100 Helper functions that can operate on any <code>Object</code>.
104 <DL>
105 <DT><B>Author:</B></DT>
106 <DD>Laurence Gonsalves</DD>
107 </DL>
108 <HR>
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>
119 </TR>
120 <TR BGCOLOR="white" CLASS="TableRowColor">
121 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
122 <CODE>static&nbsp;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>&nbsp;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>&nbsp;b)</CODE>
126 <BR>
127 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Determines whether two possibly-null objects are equal.</TD>
128 </TR>
129 <TR BGCOLOR="white" CLASS="TableRowColor">
130 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
131 <CODE>static
132 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
133 <TR ALIGN="right" VALIGN="">
134 <TD NOWRAP><FONT SIZE="-1">
135 <CODE>&lt;T&gt; T</CODE></FONT></TD>
136 </TR>
137 </TABLE>
138 </CODE></FONT></TD>
139 <TD><CODE><B><A HREF="../../../../com/google/common/base/Objects.html#firstNonNull(T, T)">firstNonNull</A></B>(T&nbsp;first,
140 T&nbsp;second)</CODE>
142 <BR>
143 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>
145 </TR>
146 <TR BGCOLOR="white" CLASS="TableRowColor">
147 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
148 <CODE>static&nbsp;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>...&nbsp;objects)</CODE>
151 <BR>
152 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Generates a hash code for multiple values.</TD>
153 </TR>
154 </TABLE>
155 &nbsp;<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>
159 </TR>
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>
162 </TR>
163 </TABLE>
164 &nbsp;
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>
174 </TR>
175 </TABLE>
177 <A NAME="equal(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
178 equal</H3>
179 <PRE>
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>&nbsp;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>&nbsp;b)</PRE>
184 <DL>
185 <DD>Determines whether two possibly-null objects are equal. Returns:
187 <ul>
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.
192 </ul>
194 <p>This assumes that any non-null objects passed to this function conform
195 to the <code>equals()</code> contract.
197 <DD><DL>
198 </DL>
199 </DD>
200 </DL>
201 <HR>
203 <A NAME="hashCode(java.lang.Object...)"><!-- --></A><H3>
204 hashCode</H3>
205 <PRE>
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>...&nbsp;objects)</PRE>
207 <DL>
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:
214 <pre>
215 public int hashCode() {
216 return Objects.hashCode(getX(), getY(), getZ());
217 }</pre>
219 <b>Warning</b>: When a single object is supplied, the returned hash code
220 does not equal the hash code of that object.
222 <DD><DL>
223 </DL>
224 </DD>
225 </DL>
226 <HR>
228 <A NAME="firstNonNull(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="firstNonNull(T, T)"><!-- --></A><H3>
229 firstNonNull</H3>
230 <PRE>
231 public static &lt;T&gt; 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>
232 T&nbsp;first,
233 <FONT SIZE="-1"><A HREF="../../../../com/google/common/base/Nullable.html" title="annotation in com.google.common.base">@Nullable</A></FONT>
234 T&nbsp;second)</PRE>
235 <DL>
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>.
239 <DD><DL>
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>
244 <DT><B>Throws:</B>
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>
247 </DD>
248 </DL>
249 <!-- ========= END OF CLASS DATA ========= -->
250 <HR>
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="">
257 <TR>
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>&nbsp;</TD>
263 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
264 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
265 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
266 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
267 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
268 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
269 </TR>
270 </TABLE>
271 </TD>
272 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
273 </EM>
274 </TD>
275 </TR>
277 <TR>
278 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
279 &nbsp;<A HREF="../../../../com/google/common/base/Nullable.html" title="annotation in com.google.common.base"><B>PREV CLASS</B></A>&nbsp;
280 &nbsp;<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> &nbsp;
283 &nbsp;<A HREF="Objects.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
284 &nbsp;<SCRIPT type="text/javascript">
285 <!--
286 if(window==top) {
287 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
289 //-->
290 </SCRIPT>
291 <NOSCRIPT>
292 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
293 </NOSCRIPT>
296 </FONT></TD>
297 </TR>
298 <TR>
299 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
300 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
301 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
302 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
303 </TR>
304 </TABLE>
305 <A NAME="skip-navbar_bottom"></A>
306 <!-- ======== END OF BOTTOM NAVBAR ======= -->
308 <HR>
310 </BODY>
311 </HTML>