コード例 #1
0
  @Test
  public void testHashMap() {
    TestData data = Utils.generateTestData(1000);

    String mapName = "ProbingHashMap";
    HashMap<Integer, String> map = new HashMap<Integer, String>(HashMap.Type.PROBING);
    java.util.Map<Integer, String> jMap = map.toMap();

    assertTrue(MapTest.testMap(map, Integer.class, mapName, data.unsorted, data.invalid));
    assertTrue(
        JavaMapTest.testJavaMap(
            jMap, Integer.class, mapName, data.unsorted, data.sorted, data.invalid));

    mapName = "LinkingHashMap";
    map = new HashMap<Integer, String>(HashMap.Type.CHAINING);
    jMap = map.toMap();

    assertTrue(MapTest.testMap(map, Integer.class, mapName, data.unsorted, data.invalid));
    assertTrue(
        JavaMapTest.testJavaMap(
            jMap, Integer.class, mapName, data.unsorted, data.sorted, data.invalid));
  }
コード例 #2
0
  @Test
  public void testSkipListMap() {
    TestData data = Utils.generateTestData(1000);

    String mapName = "SkipListMap";
    SkipListMap<String, Integer> map = new SkipListMap<String, Integer>();
    java.util.Map<String, Integer> jMap = map.toMap();

    assertTrue(MapTest.testMap(map, Type.String, mapName, data.unsorted, data.invalid));
    assertTrue(
        JavaMapTest.testJavaMap(
            jMap, Type.Integer, mapName, data.unsorted, data.sorted, data.invalid));
  }