Java examples for Scripting:Bindings
Using Bindings Objects
import javax.script.Bindings; import javax.script.SimpleBindings; public class Main { public static void main(String[] args) { Bindings params = new SimpleBindings(); params.put("msg", "Hello"); params.put("year", 2018); Object msg = params.get("msg"); Object year = params.get("year"); System.out.println("msg = " + msg); System.out.println("year = " + year); // Remove year from Bindings params.remove("year"); year = params.get("year"); boolean containsYear = params.containsKey("year"); System.out.println("year = " + year); System.out.println("params contains year = " + containsYear); }/* w ww . java 2 s. co m*/ }