Created
June 29, 2019 13:56
-
-
Save mnowotka/42c0aba7d91d9fddd61866db7fbbdc2a to your computer and use it in GitHub Desktop.
This file contains 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
public static void main(String[] args){ | |
JokeSource source = new APIJokeSource(); | |
JokeHistory history_provider = new FileHistoryProvider(); | |
Set<JokeId> history = history_provider.load() | |
List<NorrisJoke> unique_jokes = new ArrayList<>(); | |
while(unique_jokes.size() < 10){ | |
List<NorrisJoke> jokes = source.getJokes(10); | |
for(joke: jokes){ | |
if(!history.contains(JokeId(joke.id))){ | |
unique_jokes.append(joke); | |
history.add(JokeId(joke.id))); | |
} | |
} | |
} | |
history_provider.save(history); | |
// tutaj będzie drukowanie wyników na konsolę | |
sys.out.println() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment