AFAIK, this cast is not necessary. &lt;nitpick&gt;Also, the parens around lessFun are superfluous&lt;/nitpick&gt;