@SuppressWarnings("unchecked")
    public TreeMap arbitrary(Random random, long size)
    {
        int length = (int) Arbitrary.random(random, 0, 
                                      Math.min(Integer.MAX_VALUE, size));
        TreeMap map = new TreeMap();
        for (int i = 0; i < length; ++i) {
            Object key = keyGenerator.arbitrary(random, size);
            Object value = valueGenerator.arbitrary(random, size);
            map.put(key, value);
        }
        
        return map;
    }