Returns a new modifiable map, initialized with the specified items.
The implementation used for the list is chosen by the compiler, there is no guarantees on which will be used, just that it will be modifiable. If you require a specific implementation you can use one of the more specific list constructors, e.g. newHashMap, newLinkedHashMap, newTreeMap or newWeakHashMap.
The map is initialized with the items you supply as arguments. You can supply any number of arguments, but each argument must be one of the supported types and is treated accordingly. If there are mutliple definitions for a given key, the key-value pair that appears closer to the right hand end of the argument list will override any earlier definitions.
The different types of arguments are handled as follows:
:-) newMap( newList( "akey", "avalue" ) );
There is 1 result
{akey=avalue}
:-) newMap( { "anotherkey", "anothervalue" } );
There is 1 result
{anotherkey=anothervalue}
:-) newMap( newMaplet( "akey", "avalue" ) );
There is 1 result
{akey=avalue}
:-) newMap( "anotherakey" ==> "anothervalue" );
There is 1 result
{anotherkey=anothervalue}
:-) newMap( newMap( "akey" ==> "avalue" ) );
There is 1 result
{akey=avalue}
Lets also have a slightly more complex example to show all the features interacting:
:-) newMap(
:-) "akey" ==> "avalue",
:-) "anotherkey" ==> "anothervalue",
:-) "key" ==> "untouched",
:-) { "key1", "value1", "akey", "adifferentvalue" },
:-) newMap(
:-) "key2" ==> "value2",
:-) "anotherkey" ==> "boo!"
:-) )
:-) );
There is 1 result
{key1=value1, key=untouched, key2=value2, anotherkey=boo!, akey=adifferentvalue}