/* * mapex.aikido * * Darwin Language System, * export version: 1.00 * Copyright (c) 2002 Sun Microsystems, Inc. * * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version 1.0 (the "License"). You * may not use this file except in compliance with the License. A copy of the License is available * at http://www.opensource.org/licenses/sunpublic.php * * The Original Code is Aikido. * The Initial Developer of the Original Code is David Allison on behalf of Sun Microsystems, Inc. * Copyright (C) Sun Microsystems, Inc. 2000-2003. All Rights Reserved. * * * Contributor(s): dallison * * Version: 1.3 * Created by dallison on 4/19/2002 * Last modified by dallison on 03/07/29 */ // example of use of map the map monitor import map // import the map.dwn file var m = new Map() // make a new Map instance // insert a couple of values m.insert ("A", 1) m.insert ("B", 2) // look for a value and extract it in 2 ways if (m.isPresent("A")) { println ("A is present") var val1 = m["A"] var val2 = m.find ("A") println ("value is " + val1 + ", " + val2) } // clear the map m.clear() // check that it is clear if (m.size() != 0) { println ("map is not clear") } // we shouldn't have a value now if (m.isPresent ("A")) { println ("A is still present, shouldn't be") }