Advertisement
DulcetAirman

getter as method reference

Nov 11th, 2018
141
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. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement