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:56 PST 2010 --> 6 <TITLE> 7 Function (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"> 15 function windowTitle() 16 { 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="Function (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> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Function.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </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 <A HREF="../../../../com/google/common/base/FinalizableWeakReference.html" title="class in com.google.common.base"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/base/Functions.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../../index.html?com/google/common/base/Function.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Function.html" target="_top"><B>NO FRAMES</B></A> 63 <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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81 DETAIL: FIELD | CONSTR | <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"> 91 com.google.common.base</FONT> 92 <BR> 93 Interface Function<F,T></H2> 94 <DL> 95 <DT><DT><B>Type Parameters:</B><DD><CODE>F</CODE> - the type of the function input<DD><CODE>T</CODE> - the type of the function output</DL> 96 <HR> 97 <DL> 98 <DT><PRE>public interface <B>Function<F,T></B></DL> 99 </PRE> 100 101 <P> 102 A transformation from one object to another. For example, a 103 <code>StringToIntegerFunction</code> may implement 104 <code>Function<String,Integer></code> and transform integers in 105 <code>String</code> format to <code>Integer</code> format. 106 107 <p>The transformation on the source object does not necessarily result in 108 an object of a different type. For example, a 109 <code>FarenheitToCelsiusFunction</code> may implement 110 <code>Function<Float,Float></code>. 111 112 <p>Implementations which may cause side effects upon evaluation are strongly 113 encouraged to state this fact clearly in their API documentation. 114 <P> 115 116 <P> 117 <DL> 118 <DT><B>Since:</B></DT> 119 <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD> 120 <DT><B>Author:</B></DT> 121 <DD>Kevin Bourrillion, Scott Bonneau</DD> 122 </DL> 123 <HR> 124 125 <P> 126 127 <!-- ========== METHOD SUMMARY =========== --> 128 129 <A NAME="method_summary"><!-- --></A> 130 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 131 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 132 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 133 <B>Method Summary</B></FONT></TH> 134 </TR> 135 <TR BGCOLOR="white" CLASS="TableRowColor"> 136 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 137 <CODE> <A HREF="../../../../com/google/common/base/Function.html" title="type parameter in Function">T</A></CODE></FONT></TD> 138 <TD><CODE><B><A HREF="../../../../com/google/common/base/Function.html#apply(F)">apply</A></B>(<A HREF="../../../../com/google/common/base/Function.html" title="type parameter in Function">F</A> from)</CODE> 139 140 <BR> 141 Applies the function to an object of type <code>F</code>, resulting in an object 142 of type <code>T</code>.</TD> 143 </TR> 144 <TR BGCOLOR="white" CLASS="TableRowColor"> 145 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 146 <CODE> boolean</CODE></FONT></TD> 147 <TD><CODE><B><A HREF="../../../../com/google/common/base/Function.html#equals(java.lang.Object)">equals</A></B>(<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> obj)</CODE> 148 149 <BR> 150 Indicates whether some other object is equal to this <code>Function</code>.</TD> 151 </TR> 152 </TABLE> 153 154 <P> 155 156 <!-- ============ METHOD DETAIL ========== --> 157 158 <A NAME="method_detail"><!-- --></A> 159 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 160 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 161 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 162 <B>Method Detail</B></FONT></TH> 163 </TR> 164 </TABLE> 165 166 <A NAME="apply(java.lang.Object)"><!-- --></A><A NAME="apply(F)"><!-- --></A><H3> 167 apply</H3> 168 <PRE> 169 <A HREF="../../../../com/google/common/base/Function.html" title="type parameter in Function">T</A> <B>apply</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> 170 <A HREF="../../../../com/google/common/base/Function.html" title="type parameter in Function">F</A> from)</PRE> 171 <DL> 172 <DD>Applies the function to an object of type <code>F</code>, resulting in an object 173 of type <code>T</code>. Note that types <code>F</code> and <code>T</code> may or may not 174 be the same. 175 <P> 176 <DD><DL> 177 <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source object 178 <DT><B>Returns:</B><DD>the resulting object</DL> 179 </DD> 180 </DL> 181 <HR> 182 183 <A NAME="equals(java.lang.Object)"><!-- --></A><H3> 184 equals</H3> 185 <PRE> 186 boolean <B>equals</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> 187 <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> obj)</PRE> 188 <DL> 189 <DD>Indicates whether some other object is equal to this <code>Function</code>. 190 This method can return <code>true</code> <i>only</i> if the specified object is 191 also a <code>Function</code> and, for every input object <code>o</code>, it returns 192 exactly the same value. Thus, <code>function1.equals(function2)</code> implies 193 that either <code>function1.apply(o)</code> and <code>function2.apply(o)</code> are 194 both null, or <code>function1.apply(o).equals(function2.apply(o))</code>. 195 196 <p>Note that it is always safe <em>not</em> to override 197 <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(java.lang.Object)</CODE></A>. 198 <P> 199 <DD><DL> 200 <DT><B>Overrides:</B><DD><CODE><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></CODE> in class <CODE><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></CODE></DL> 201 </DD> 202 <DD><DL> 203 </DL> 204 </DD> 205 </DL> 206 <!-- ========= END OF CLASS DATA ========= --> 207 <HR> 208 209 210 <!-- ======= START OF BOTTOM NAVBAR ====== --> 211 <A NAME="navbar_bottom"><!-- --></A> 212 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 213 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 214 <TR> 215 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 216 <A NAME="navbar_bottom_firstrow"><!-- --></A> 217 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 218 <TR ALIGN="center" VALIGN="top"> 219 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 220 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 221 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 222 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Function.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 223 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 224 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 225 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 226 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 227 </TR> 228 </TABLE> 229 </TD> 230 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 231 </EM> 232 </TD> 233 </TR> 234 235 <TR> 236 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 237 <A HREF="../../../../com/google/common/base/FinalizableWeakReference.html" title="class in com.google.common.base"><B>PREV CLASS</B></A> 238 <A HREF="../../../../com/google/common/base/Functions.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 239 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 240 <A HREF="../../../../index.html?com/google/common/base/Function.html" target="_top"><B>FRAMES</B></A> 241 <A HREF="Function.html" target="_top"><B>NO FRAMES</B></A> 242 <SCRIPT type="text/javascript"> 243 <!-- 244 if(window==top) { 245 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 246 } 247 //--> 248 </SCRIPT> 249 <NOSCRIPT> 250 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 251 </NOSCRIPT> 252 253 254 </FONT></TD> 255 </TR> 256 <TR> 257 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 258 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 259 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 260 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 261 </TR> 262 </TABLE> 263 <A NAME="skip-navbar_bottom"></A> 264 <!-- ======== END OF BOTTOM NAVBAR ======= --> 265 266 <HR> 267 268 </BODY> 269 </HTML> 270