public void testValueCollectionToArray() {
        int element_count = 20;
        int[] keys = new int[element_count];
        String[] vals = new String[element_count];

        TIntObjectMap<String> raw_map = new TIntObjectHashMap<String>();
        for (int i = 0; i < element_count; i++) {
            keys[i] = i + 1;
            vals[i] = Integer.toString(i + 1);
            raw_map.put(keys[i], vals[i]);
        }
        Map<Integer, String> map = TDecorators.wrap(raw_map);
        assertEquals(element_count, map.size());

        Collection<String> collection = map.values();
        for (int i = 0; i < collection.size(); i++) {
            assertTrue(collection.contains(vals[i]));
        }
        assertFalse(collection.isEmpty());

        Object[] values_obj_array = collection.toArray();
        int count = 0;
        Iterator<String> iter = collection.iterator();
        while (iter.hasNext()) {
            String value = iter.next();
            assertTrue(collection.contains(value));
            assertEquals(values_obj_array[count], value);
            count++;
        }

        //noinspection ToArrayCallWithZeroLengthArrayArgument
        String[] values_array = collection.toArray(new String[0]);
        count = 0;
        iter = collection.iterator();
        while (iter.hasNext()) {
            String value = iter.next();
            assertTrue(collection.contains(value));
            assertEquals(values_array[count], value);
            count++;
        }

        values_array = collection.toArray(new String[collection.size()]);
        count = 0;
        iter = collection.iterator();
        while (iter.hasNext()) {
            String value = iter.next();
            assertTrue(collection.contains(value));
            assertEquals(values_array[count], value);
            count++;
        }

        values_array = collection.toArray(new String[collection.size() * 2]);
        count = 0;
        iter = collection.iterator();
        while (iter.hasNext()) {
            String value = iter.next();
            assertTrue(collection.contains(value));
            assertEquals(values_array[count], value);
            count++;
        }
        assertNull(values_array[collection.size()]);
        assertNull(values_array[collection.size()]);

        Collection<String> other = new ArrayList<String>(collection);
        assertFalse(collection.retainAll(other));
        other.remove(vals[5]);
        assertTrue(collection.retainAll(other));
        assertFalse(collection.contains(vals[5]));
        assertFalse(map.containsKey(keys[5]));

        collection.clear();
        assertTrue(collection.isEmpty());
    }