• Execute continuously Map<String, Object> scope = new HashMap<String, Object>(); // The scope where we bind data in and out Binding binding = new Binding(); binding.setVariable("scope", scope); // Create a shell with the proper binding GroovyShell shell = new GroovyShell(binding); // Evaluate the result shell.evaluate(content); // Now get back what we want.. Closure setup = (Closure) binding.getVariable("setup"); Closure tick = (Closure) binding.getVariable("tick"); Table table = new Table(); setup.call(table); // Preserve original table.. createMemento(table); List<Trade> trades = getBondTrades(); // For each tick.. table = restoreMemento(); tick.call(trades, table); System.out.println(table);