0

I frequently come across this in some RxJava example ?

Observable.create(subscriber -> {
      subscriber.onNext("Hello World!");
      subscriber.onCompleted();
}).subscribe(System.out::println);
Suren Srapyan
  • 66,568
  • 14
  • 114
  • 112
  • http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/Lambda-QuickStart/index.html – GAlexMES Jan 10 '17 at 06:30
  • @GAlexMES No, it's a method reference. – shmosel Jan 10 '17 at 06:33
  • @shmosel It is a method reference yes. But a method reference is a Lambda expression. Have a look to the Oracle documentation: __Method references enable you to do this; they are compact, easy-to-read lambda expressions for methods that already have a name.__ – GAlexMES Jan 10 '17 at 06:35
  • @GAlexMES I stand corrected. – shmosel Jan 10 '17 at 06:36
  • 1
    @GAlexMES - thank you for quick respond and pointers, somehow I was not able to do google or so by "::" :) –  Jan 10 '17 at 07:02
  • @shmosel - thank a lot :) –  Jan 10 '17 at 07:03

1 Answers1

0

That is a Method Reference.

See: https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html

Patrick Parker
  • 4,863
  • 4
  • 19
  • 51