Lambdas
-
Make a copy of your PresidentAppInnerClasses.java (so you can keep the original for reference), and name the new copy PresidentAppLambda.java.
-
Make sure the new class's
maininstantiates aPresidentAppLambda, notPresidentAppInnerClasses. -
In the new copy, replace all inner classes with Lambda expressions.
-
Start by replacing anonymous classes, then replace local and member class instantiations.
-
Remove any local or member class definitions from your class.
-
Update any remaining
sortorfiltercalls to use lambdas. -
Modify
filterto useBiPredicateinstead ofPresidentMatcher.
Stretch Goals¶
-
If you haven't already, create a method that takes a list of presidents and writes it as tab-separated values to a file.
-
Records should be formatted so the existing code would be able to read and parse the records.
-
When testing, be careful NOT to use resources/presidents.tsv as the output file!
-
Pass filtered lists and filenames to this method to save files with the presidents from each party.