Created
June 8, 2016 05:15
-
-
Save mindwing/1fe8efda31d0e3c6435e7e49aad5f640 to your computer and use it in GitHub Desktop.
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
// For type clarity only, the following are smaller, reused operators: | |
Function<String, DataBlob> urlToBlob = …; | |
Function<DataBlob, List<ItemBlob>> blobToItemBlobs = …; | |
Predicate<ItemBlob> activeOnly = …; | |
Function<ItemBlob, UiModel> itemBlobToUiModel = …; | |
Function<List<UiModel>, List<UiModel>> sortByDateDesc = …; | |
Function<String, List<UiModel>> urlToUiModels = | |
Functions.functionFrom(String.class) | |
.apply(urlToBlob) | |
.unpack(blobToItemBlobs) | |
.filter(activeOnly) | |
.map(itemBlobToUiModel) | |
.morph(sortByDateDesc) | |
.thenLimit(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment