June 2017
Beginner
1296 pages
69h 23m
English
... . For each available ProblemProvider implementation, the stream contains one Provider<ProblemProvider> object. Line 24 uses Stream method collect and the predefined Collector defined by Collectors.toList to get the List containing all the available implementations. If that List is empty (line 27) the program displays an appropriate message and terminates.
If the List contains any service-provider implementations, lines 36–46 use them to display one math problem at a time to the user. Lines 38–39
ProblemProvider provider =
providersList.get(random.nextInt(providersList.size())).get();
randomly select one Provider<ProblemProvider> object from the providersList, then invoke that object’s get method to obtain ...
Read now
Unlock full access