Type keyType = AnyConverter.getType( _keys[0] );
Type valueType = AnyConverter.getType( _values[0] );
// create a map for the given types
XMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(),
keyType, valueType );
assure( _context + ": key types do not match", map.getKeyType().equals( keyType ) );
assure( _context + ": value types do not match", map.getValueType().equals( valueType ) );
// insert all values
assure( _context + ": initially created map is not empty", map.hasElements() );
impl_putAll( map, _keys, _values );
assure( _context + ": map filled with values is still empty", !map.hasElements() );
// and verify them
impl_ceckContent( map, _keys, _values, _context );
// remove all values
for ( int i=_keys.length-1; i>=0; --i )
{
// ensure 'remove' really returns the old value
assureEquals( _context + ": wrong 'old value' for removal of " + impl_getNth(i) + " value",
_values[i], map.remove( _keys[i] ) );
}
assure( _context + ":map not empty after removing all elements", map.hasElements() );
// insert again, and check whether 'clear' does what it should do
impl_putAll( map, _keys, _values );
map.clear();
assure( _context + ": 'clear' does not empty the map", map.hasElements() );
// try the constructor which creates an immutable version
Pair< ?, ? >[] initialMappings = new Pair< ?, ? >[ _keys.length ];
for ( int i=0; i<_keys.length; ++i )
initialMappings[i] = new Pair< Object, Object >( _keys[i], _values[i] );