Skip to content

Instantly share code, notes, and snippets.

@Raouf25
Created April 3, 2020 10:15
Show Gist options
  • Save Raouf25/bf937f9cfc9dc45e5e14fea1fd15d92b to your computer and use it in GitHub Desktop.
Save Raouf25/bf937f9cfc9dc45e5e14fea1fd15d92b to your computer and use it in GitHub Desktop.
// Use the City's method references and assign them to functions
Function<City, String> getNameFunction = City::getName;
Function<City, String> getCodeFunction = City::getCode;
System.out.println("The code for "
+ getNameFunction.apply(sf)
+ " is "
+ getCodeFunction.apply(sf));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment