1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-17 01:17:29 +02:00
unleash.unleash/unleash-client-java/src/main/java/no/finn/unleash/ToggleCollection.java
2014-10-30 14:34:33 +01:00

26 lines
630 B
Java

package no.finn.unleash;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
final class ToggleCollection {
private Collection<Toggle> features = Collections.emptyList();
private Map<String, Toggle> cache;
ToggleCollection(final Collection<Toggle> features) {
this.features = features;
cache = new HashMap<>();
features.forEach(toggle -> cache.put(toggle.getName(), toggle));
}
Collection<Toggle> getFeatures() {
return features;
}
Toggle getToggle(final String name) {
return cache.get(name);
}
}