Instantly share code, notes, and snippets.

@cajar1988 /tuple.java Secret
Last active Oct 30, 2015

Embed
What would you like to do?
Tuple2<String, String> almostPerson = Tuple.of("Tomasz", "Nowak");
int personAge = 19;
Address address = new Address("Szczecin", "Nizinna");
Function4<String, String, Integer, Address, Person> createPerson = Person::new;
Function2<Integer, Address, Person> namedOnly = createPerson.apply(almostPerson._1, almostPerson._2);
Function1<Address, Person> namedAndAged = namedOnly.apply(personAge);
Person fullPerson = namedAndAged.apply(address);
//inne podejscie, jesli mamy od razu dostep do innych wymaganych argumentow
Person alsoFulllPerson = almostPerson.transform(val -> new Person(val._1, val._2, personAge, address));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment