Download this file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
package jscript.engine; import java.util.*; public class CloneableStack extends Stack implements Cloneable { private static final long serialVersionUID = 1L; public Object clone() { CloneableStack s = new CloneableStack(); for (Iterator it = this.iterator(); it.hasNext();) { Object o = it.next(); if (o instanceof HashMap) s.push(((HashMap)o).clone()); else s.push(o); } return s; } }