Last active
August 14, 2021 08:59
-
-
Save muthuishere/5c0c8970a64e301ed92b65127d5c9dab to your computer and use it in GitHub Desktop.
Declarativex
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
results= Try.from(()->newsService.downloadFromNyTimes(topic)) | |
.or(()->newsService.downloadFromHerald(topic)) | |
.or(()->newsService.downloadFromSun(topic)) | |
.get(); |
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
results= Try.any(newsService::downloadFromNyTimes, | |
newsService::downloadFromHerald, | |
newsService::downloadFromSun) | |
.with(topic) | |
.get(); |
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
List<String> results = null; | |
try { | |
results =newsService.downloadFromNyTimes(topic); | |
}catch (Exception e){ | |
try { | |
results =newsService.downloadFromHerald(topic); | |
}catch (Exception e1){ | |
try { | |
results =newsService.downloadFromSun(topic); | |
}catch (Exception ignored){ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment