Advertisement
DulcetAirman

getter as method reference

Nov 11th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement