static StringDoubleMap test(int n, int range) { // Generate random data Random rand = new Random(); Set<Integer> set = new HashSet<Integer>(); for (int i = 0; i < n; i++) set.add(rand.nextInt(range)); // Make the map StringDoubleMap map = new StringDoubleMap(0); // map.switchToSortedList(); for (int x : set) { map.put("" + x, 1.0 * x); } // System.out.println("here"); check(set, map); map.switchToSortedList(); check(set, map); map.switchToHashTable(); check(set, map); map.lock(); for (int x : set) map.put("" + x, 1.0 * x); assert set.size() == map.size(); return map; }