Home | History | Annotate | Download | only in base
      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 Functions (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="Functions (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/Functions.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/base/Function.html" title="interface in com.google.common.base"><B>PREV CLASS</B></A>&nbsp;
     59 &nbsp;<A HREF="../../../../com/google/common/base/Joiner.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/Functions.html" target="_top"><B>FRAMES</B></A>  &nbsp;
     62 &nbsp;<A HREF="Functions.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">
     81 DETAIL:&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">
     91 com.google.common.base</FONT>
     92 <BR>
     93 Class Functions</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.base.Functions</B>
     97 </PRE>
     98 <HR>
     99 <DL>
    100 <DT><PRE>public final class <B>Functions</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>
    104 Useful functions.
    105 
    106  <p>All methods returns serializable functions as long as they're given
    107  serializable parameters.
    108 <P>
    109 
    110 <P>
    111 <DL>
    112 <DT><B>Since:</B></DT>
    113   <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD>
    114 <DT><B>Author:</B></DT>
    115   <DD>Mike Bostock, Vlad Patryshev, Jared Levy</DD>
    116 </DL>
    117 <HR>
    118 
    119 <P>
    120 
    121 <!-- ========== METHOD SUMMARY =========== -->
    122 
    123 <A NAME="method_summary"><!-- --></A>
    124 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    125 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    126 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    127 <B>Method Summary</B></FONT></TH>
    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;A,B,C&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;A,C&gt;</CODE></FONT></TD>
    136 </TR>
    137 </TABLE>
    138 </CODE></FONT></TD>
    139 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#compose(com.google.common.base.Function, com.google.common.base.Function)">compose</A></B>(<A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;B,C&gt;&nbsp;g,
    140         <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;A,? extends B&gt;&nbsp;f)</CODE>
    141 
    142 <BR>
    143 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the composition of two functions.</TD>
    144 </TR>
    145 <TR BGCOLOR="white" CLASS="TableRowColor">
    146 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    147 <CODE>static
    148 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    149 <TR ALIGN="right" VALIGN="">
    150 <TD NOWRAP><FONT SIZE="-1">
    151 <CODE>&lt;E&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;<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>,E&gt;</CODE></FONT></TD>
    152 </TR>
    153 </TABLE>
    154 </CODE></FONT></TD>
    155 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#constant(E)">constant</A></B>(E&nbsp;value)</CODE>
    156 
    157 <BR>
    158 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a function that returns <code>value</code> for any input.</TD>
    159 </TR>
    160 <TR BGCOLOR="white" CLASS="TableRowColor">
    161 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    162 <CODE>static
    163 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    164 <TR ALIGN="right" VALIGN="">
    165 <TD NOWRAP><FONT SIZE="-1">
    166 <CODE>&lt;K,V&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;K,V&gt;</CODE></FONT></TD>
    167 </TR>
    168 </TABLE>
    169 </CODE></FONT></TD>
    170 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#forMap(java.util.Map, V)">forMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;K,? extends V&gt;&nbsp;map,
    171        V&nbsp;defaultValue)</CODE>
    172 
    173 <BR>
    174 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a function which performs a map lookup with a default value.</TD>
    175 </TR>
    176 <TR BGCOLOR="white" CLASS="TableRowColor">
    177 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    178 <CODE>static
    179 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    180 <TR ALIGN="right" VALIGN="">
    181 <TD NOWRAP><FONT SIZE="-1">
    182 <CODE>&lt;K,V&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;K,V&gt;</CODE></FONT></TD>
    183 </TR>
    184 </TABLE>
    185 </CODE></FONT></TD>
    186 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#forMap(java.util.Map)">forMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;K,V&gt;&nbsp;map)</CODE>
    187 
    188 <BR>
    189 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a function which performs a map lookup.</TD>
    190 </TR>
    191 <TR BGCOLOR="white" CLASS="TableRowColor">
    192 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    193 <CODE>static
    194 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    195 <TR ALIGN="right" VALIGN="">
    196 <TD NOWRAP><FONT SIZE="-1">
    197 <CODE>&lt;T&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;T,<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>
    198 </TR>
    199 </TABLE>
    200 </CODE></FONT></TD>
    201 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#forPredicate(com.google.common.base.Predicate)">forPredicate</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;T&gt;&nbsp;predicate)</CODE>
    202 
    203 <BR>
    204 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a function that returns the same boolean output as the given
    205  predicate for all inputs.</TD>
    206 </TR>
    207 <TR BGCOLOR="white" CLASS="TableRowColor">
    208 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    209 <CODE>static
    210 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    211 <TR ALIGN="right" VALIGN="">
    212 <TD NOWRAP><FONT SIZE="-1">
    213 <CODE>&lt;E&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;E,E&gt;</CODE></FONT></TD>
    214 </TR>
    215 </TABLE>
    216 </CODE></FONT></TD>
    217 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#identity()">identity</A></B>()</CODE>
    218 
    219 <BR>
    220 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the identity function.</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="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;<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>,<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>&gt;</CODE></FONT></TD>
    225 <TD><CODE><B><A HREF="../../../../com/google/common/base/Functions.html#toStringFunction()">toStringFunction</A></B>()</CODE>
    226 
    227 <BR>
    228 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a function that calls <code>toString()</code> on its argument.</TD>
    229 </TR>
    230 </TABLE>
    231 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
    232 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    233 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
    234 <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>
    235 </TR>
    236 <TR BGCOLOR="white" CLASS="TableRowColor">
    237 <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>
    238 </TR>
    239 </TABLE>
    240 &nbsp;
    241 <P>
    242 
    243 <!-- ============ METHOD DETAIL ========== -->
    244 
    245 <A NAME="method_detail"><!-- --></A>
    246 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    247 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    248 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    249 <B>Method Detail</B></FONT></TH>
    250 </TR>
    251 </TABLE>
    252 
    253 <A NAME="toStringFunction()"><!-- --></A><H3>
    254 toStringFunction</H3>
    255 <PRE>
    256 public static <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;<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>,<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>&gt; <B>toStringFunction</B>()</PRE>
    257 <DL>
    258 <DD>Returns a function that calls <code>toString()</code> on its argument. The
    259  function does not accept nulls; it will throw a
    260  <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> when applied to <code>null</code>.
    261 <P>
    262 <DD><DL>
    263 </DL>
    264 </DD>
    265 </DL>
    266 <HR>
    267 
    268 <A NAME="identity()"><!-- --></A><H3>
    269 identity</H3>
    270 <PRE>
    271 public static &lt;E&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;E,E&gt; <B>identity</B>()</PRE>
    272 <DL>
    273 <DD>Returns the identity function.
    274 <P>
    275 <DD><DL>
    276 </DL>
    277 </DD>
    278 </DL>
    279 <HR>
    280 
    281 <A NAME="forMap(java.util.Map)"><!-- --></A><H3>
    282 forMap</H3>
    283 <PRE>
    284 public static &lt;K,V&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;K,V&gt; <B>forMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;K,V&gt;&nbsp;map)</PRE>
    285 <DL>
    286 <DD>Returns a function which performs a map lookup. The returned function
    287  throws an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> if given a key that does not
    288  exist in the map.
    289 <P>
    290 <DD><DL>
    291 </DL>
    292 </DD>
    293 </DL>
    294 <HR>
    295 
    296 <A NAME="forMap(java.util.Map,java.lang.Object)"><!-- --></A><A NAME="forMap(java.util.Map, V)"><!-- --></A><H3>
    297 forMap</H3>
    298 <PRE>
    299 public static &lt;K,V&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;K,V&gt; <B>forMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;K,? extends V&gt;&nbsp;map,
    300                                          <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>
    301                                          V&nbsp;defaultValue)</PRE>
    302 <DL>
    303 <DD>Returns a function which performs a map lookup with a default value. The
    304  function created by this method returns <code>defaultValue</code> for all
    305  inputs that do not belong to the map's key set.
    306 <P>
    307 <DD><DL>
    308 <DT><B>Parameters:</B><DD><CODE>map</CODE> - source map that determines the function behavior<DD><CODE>defaultValue</CODE> - the value to return for inputs that aren't map keys
    309 <DT><B>Returns:</B><DD>function that returns <code>map.get(a)</code> when <code>a</code> is a key,
    310      or <code>defaultValue</code> otherwise</DL>
    311 </DD>
    312 </DL>
    313 <HR>
    314 
    315 <A NAME="compose(com.google.common.base.Function, com.google.common.base.Function)"><!-- --></A><H3>
    316 compose</H3>
    317 <PRE>
    318 public static &lt;A,B,C&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;A,C&gt; <B>compose</B>(<A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;B,C&gt;&nbsp;g,
    319                                             <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;A,? extends B&gt;&nbsp;f)</PRE>
    320 <DL>
    321 <DD>Returns the composition of two functions. For <code>f: A-&gt;B</code> and
    322  <code>g: B-&gt;C</code>, composition is defined as the function h such that
    323  <code>h(a) == g(f(a))</code> for each <code>a</code>.
    324 <P>
    325 <DD><DL>
    326 <DT><B>Parameters:</B><DD><CODE>g</CODE> - the second function to apply<DD><CODE>f</CODE> - the first function to apply
    327 <DT><B>Returns:</B><DD>the composition of <code>f</code> and <code>g</code><DT><B>See Also:</B><DD><a href="//en.wikipedia.org/wiki/Function_composition">
    328  function composition</a></DL>
    329 </DD>
    330 </DL>
    331 <HR>
    332 
    333 <A NAME="forPredicate(com.google.common.base.Predicate)"><!-- --></A><H3>
    334 forPredicate</H3>
    335 <PRE>
    336 public static &lt;T&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;T,<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>forPredicate</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;T&gt;&nbsp;predicate)</PRE>
    337 <DL>
    338 <DD>Creates a function that returns the same boolean output as the given
    339  predicate for all inputs.
    340 <P>
    341 <DD><DL>
    342 </DL>
    343 </DD>
    344 </DL>
    345 <HR>
    346 
    347 <A NAME="constant(java.lang.Object)"><!-- --></A><A NAME="constant(E)"><!-- --></A><H3>
    348 constant</H3>
    349 <PRE>
    350 public static &lt;E&gt; <A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;<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>,E&gt; <B>constant</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>
    351                                               E&nbsp;value)</PRE>
    352 <DL>
    353 <DD>Creates a function that returns <code>value</code> for any input.
    354 <P>
    355 <DD><DL>
    356 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the constant value for the function to return
    357 <DT><B>Returns:</B><DD>a function that always returns <code>value</code></DL>
    358 </DD>
    359 </DL>
    360 <!-- ========= END OF CLASS DATA ========= -->
    361 <HR>
    362 
    363 
    364 <!-- ======= START OF BOTTOM NAVBAR ====== -->
    365 <A NAME="navbar_bottom"><!-- --></A>
    366 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
    367 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
    368 <TR>
    369 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
    370 <A NAME="navbar_bottom_firstrow"><!-- --></A>
    371 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
    372   <TR ALIGN="center" VALIGN="top">
    373   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
    374   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
    375   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
    376   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Functions.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
    377   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
    378   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
    379   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
    380   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
    381   </TR>
    382 </TABLE>
    383 </TD>
    384 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
    385 </EM>
    386 </TD>
    387 </TR>
    388 
    389 <TR>
    390 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    391 &nbsp;<A HREF="../../../../com/google/common/base/Function.html" title="interface in com.google.common.base"><B>PREV CLASS</B></A>&nbsp;
    392 &nbsp;<A HREF="../../../../com/google/common/base/Joiner.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD>
    393 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    394   <A HREF="../../../../index.html?com/google/common/base/Functions.html" target="_top"><B>FRAMES</B></A>  &nbsp;
    395 &nbsp;<A HREF="Functions.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
    396 &nbsp;<SCRIPT type="text/javascript">
    397   <!--
    398   if(window==top) {
    399     document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
    400   }
    401   //-->
    402 </SCRIPT>
    403 <NOSCRIPT>
    404   <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
    405 </NOSCRIPT>
    406 
    407 
    408 </FONT></TD>
    409 </TR>
    410 <TR>
    411 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    412   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
    413 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    414 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
    415 </TR>
    416 </TABLE>
    417 <A NAME="skip-navbar_bottom"></A>
    418 <!-- ======== END OF BOTTOM NAVBAR ======= -->
    419 
    420 <HR>
    421 
    422 </BODY>
    423 </HTML>
    424