SHARE
TWEET

getter as method reference

DulcetAirman Nov 11th, 2018 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ch.claude_martin;
  2.  
  3. import java.util.function.ToIntFunction;
  4.  
  5. public class Foo {
  6.   private int getBla(Foo this) {
  7.     return 42;
  8.   }
  9.  
  10.   public static void main(String[] args) {
  11.     ToIntFunction<Foo> ref = Foo::getBla;
  12.     System.out.println(ref.applyAsInt(new Foo()));
  13.   }
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top