Skip to content

Instantly share code, notes, and snippets.

@Raouf25
Created April 3, 2020 10:30
Show Gist options
  • Save Raouf25/a09b37b5f910a53ae4a0e207142ec4db to your computer and use it in GitHub Desktop.
Save Raouf25/a09b37b5f910a53ae4a0e207142ec4db to your computer and use it in GitHub Desktop.
// Use the City's method references and assign them to biconsumers
BiConsumer<City, String> setNameBiConsumer = City::setName;
BiConsumer<City, String> setCodeBiConsumer = City::setCode;
City ny = new City();
setNameBiConsumer.accept(ny, "New York");
setCodeBiConsumer.accept(ny, "NY");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment