HashSet<Double> valueSet = new HashSet<Double>();
for (DoubleIterator iit = map.iterator(); iit.hasNext(); ) {
valueSet.add(iit.next());
}
assertEquals(length, valueSet.size());
double[] array = map.toArray();
assertEquals(length, array.length);
for (double value: array) {
assertTrue(valueSet.contains(value));
}