Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Gene Wirchenko Newsgroups: comp.lang.java.programmer Subject: Passing a Method Name to a Method Date: Wed, 22 Jun 2011 12:46:32 -0700 Organization: A noiseless patient Spider Lines: 41 Message-ID: <81h4075t4gfjglji1n033rb20025ebho68@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="7Qrvczazr82YckO5XW8Vtw"; logging-data="26528"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Hwy+KZ8wOCnf0Ku7qc+DDteErn12emr4=" X-Newsreader: Forte Agent 4.2/32.1118 Cancel-Lock: sha1:fTjYCSoFBy2pEnzV6d9DMAJeZe0= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5540 Dear Jav'ers: Maybe I will find this after searching more, but so far, no good. I want to pass a parameter of a method name to another method. N.B.: I do not want to pass the method name as a string. I want to pass it as a pointer / reference / whatever term is used for this in Java. I am doing this to test different ways of parsing. I want to be able to do this (timing details not shown): for (i=1; i<=nRepetitions; i++) Parse(ThisWay); for (i=1; i<=nRepetitions; i++) Parse(ThatWay); static void Parse ( ????? What goes here? MethodToUse ) { ... ????? How exactly is this done? MethodToUse(actual parms) ... } static returntype ThisWay(formal parms) {...} static returntype ThatWay(formal parms) {...} The signatures and return types of ThisWay() and ThatWay() would be identical. Sincerely, Gene Wirchenko