Skip to content

Instantly share code, notes, and snippets.

@JLLeitschuh
Created December 7, 2015 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JLLeitschuh/70d9f8f99025e74a7782 to your computer and use it in GitHub Desktop.
Save JLLeitschuh/70d9f8f99025e74a7782 to your computer and use it in GitHub Desktop.
@Override
public synchronized void setValueWithKey(String key) throws IOException, IllegalArgumentException {
final List<String> keys = getKeys();
if (keys.contains(key)) {
index = keys.indexOf(key);
loadImage(paths.get(index));
} else {
throw new IllegalArgumentException(key + " was an illegal key");
}
}
@Override
public List<String> getKeys() {
return Collections.unmodifiableList(paths.stream().map(path -> Files.getNameWithoutExtension(path)).collect(Collectors.toList()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment