Created
August 11, 2016 10:07
-
-
Save bholota/4d2891374bc866df1caa5873a84f6323 to your computer and use it in GitHub Desktop.
WannaBeFunctional
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static abstract class Transform1<T, M> { | |
abstract M transform(T input); | |
} | |
private <InputType, OutputType, InputList extends List<InputType>, OutputList extends List<OutputType>> OutputList map (InputList input, Transform1<InputType, OutputType> transform1) { | |
List<OutputType> out = new ArrayList<>(); | |
for (InputType i : input) { | |
out.add(transform1.transform(i)); | |
} | |
//noinspection unchecked | |
return (OutputList)out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment