class HeterogeneousSet extends AbstractSet<E> {

    @SuppressWarnings("unchecked")
    public List<E> getObjectsAsList()
    {
        int size = 0;
        Collection<List<? extends E>> values = myClassToObjectMap.values();
        for (List<? extends E> list : values)
        {
            size += list.size();
        }
        Object[] arr = new Object[size];
        int pos = 0;
        for (List<? extends E> list : values)
        {
            System.arraycopy(list.toArray(), 0, arr, pos, list.size());
            pos += list.size();
        }
        return (List<E>)Arrays.asList(arr);
    }

}