Skip to content

Instantly share code, notes, and snippets.

@mnowotka
Created June 29, 2019 13:56
Show Gist options
  • Save mnowotka/42c0aba7d91d9fddd61866db7fbbdc2a to your computer and use it in GitHub Desktop.
Save mnowotka/42c0aba7d91d9fddd61866db7fbbdc2a to your computer and use it in GitHub Desktop.
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