Skip to content

Instantly share code, notes, and snippets.

@nikhilsaraf
Created July 16, 2020 20:25
Show Gist options
  • Save nikhilsaraf/eb4f4089a14972b9a65935598db0f51d to your computer and use it in GitHub Desktop.
Save nikhilsaraf/eb4f4089a14972b9a65935598db0f51d to your computer and use it in GitHub Desktop.
/**
sample code that gets an address book represented by a map
usage:
map = getAddressBookComplex();
phoneNumber = map.get("Ava"); // (415)-730-xxxx
*/
Map<String, String> getAddressBookComplex() {
Map<String, String> map = new HashMap<>();
map.put("Ava", "(415)-730-xxxx");
map.put("Bob", "(512)-349-xxxx");
map.put("Carl", "(917)-123-xxxx");
return map;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment