Tech questions
Question: There are millions and billions of users and we want to store country -> business type -> list of features how would I do it? No database only in java class
`public class FeatureRegistry {
private final Map<String, Map<String, List<String>>> registry = new ConcurrentHashMap<>();
// Thread-safe write path
public void addFeature(String country, String businessType, String feature) {
registry
.computeIfAbsent(country, c -> new ConcurrentHashMap<>())
.computeIfAbsent(businessType, b -> new CopyOnWriteArrayList<>())
.add(feature);
}
// Read path — return an immutable view so callers can't mutate internal state
public List<String> getFeatures(String country, String businessType) {
return Collections.unmodifiableList(
registry.getOrDefault(country, Map.of())
.getOrDefault(businessType, List.of())
);
}
} `