Code example for Cache

Methods: getIfPresent

0
 
    private final Cache<ModelType<?>, ModelSchema<?>> cache = CacheBuilder.newBuilder().build(); 
 
    @Nullable 
    public <T> ModelSchema<T> get(ModelType<T> type) { 
        return Cast.uncheckedCast(cache.getIfPresent(type)); 
    } 
 
    public <T> void set(ModelType<T> type, ModelSchema<T> schema) { 
        cache.put(type, schema); 
    } 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java