Code example for MapMaker

Methods: makeMap

0
 */ 
@ThreadSafe 
public class MvelEvaluator implements Evaluator { 
 
  //lets do some caching of expressions to see if we cant go a bit faster 
  private final ConcurrentMap<String, Serializable> compiledExpressions = new MapMaker().makeMap(); 
 
  @Nullable 
  public Object evaluate(String expr, Object bean) { 
    Serializable compiled = compiledExpressions.get(expr); 
 
    //compile and store the expr (warms up the expression cache) 
    if (null == compiled) { 
      String preparedExpression = expr; 
 
      //strip expression decorators as necessary 
      if (Parsing.isExpression(expr)) { 
        preparedExpression = Parsing.stripExpression(expr); 
      } 
 
Experience pair programming with AI  Get Codota for Java