Examples of MapII


Examples of edu.umd.cloud9.util.map.MapII

  public void testBasic1() {
    int size = 100000;
    Random r = new Random();
    int[] ints = new int[size];

    MapII map = new HMapII();
    for (int i = 0; i < size; i++) {
      int k = r.nextInt(size);
      map.put(i, k);
      ints[i] = k;
    }

    for (int i = 0; i < size; i++) {
      int v = map.get(i);

      assertEquals(ints[i], v);
      assertTrue(map.containsKey(i));
    }

  }
View Full Code Here

Examples of edu.umd.cloud9.util.map.MapII

  public void testUpdate() {
    int size = 100000;
    Random r = new Random();
    int[] ints = new int[size];

    MapII map = new HMapII();
    for (int i = 0; i < size; i++) {
      int k = r.nextInt(size);
      map.put(i, k);
      ints[i] = k;
    }

    assertEquals(size, map.size());

    for (int i = 0; i < size; i++) {
      map.put(i, ints[i] + 1);
    }

    assertEquals(size, map.size());

    for (int i = 0; i < size; i++) {
      int v = map.get(i);

      assertEquals(ints[i] + 1, v);
      assertTrue(map.containsKey(i));
    }
  }
View Full Code Here

Examples of edu.umd.cloud9.util.map.MapII

    long startTime;
    long duration;
    Random r = new Random();

    System.out.println("Benchmarking HMapKI<String>...");
    MapII map = new HMapII();
    startTime = System.currentTimeMillis();
    for (int i = 0; i < size; i++) {
      int k = r.nextInt(1000);
      boolean increment = r.nextBoolean();
      if (increment) {
View Full Code Here

Examples of edu.umd.cloud9.util.map.MapII

    int[] ints = new int[size];

    long usedMemory1 = MemoryUsageUtils.getUsedMemory();

    System.out.println("Benchmarking HMapII...");
    MapII map = new HMapII();

    startTime = System.currentTimeMillis();
    for (int i = 0; i < size; i++) {
      int k = r.nextInt(size);
      map.put(i, k);
      ints[i] = k;
    }
    duration = System.currentTimeMillis() - startTime;
    System.out.println(" Inserting " + size + " random entries: " + duration + " ms");

    startTime = System.currentTimeMillis();
    for (int i = 0; i < size; i++) {
      int v = map.get(i);

      if (v != ints[i])
        throw new RuntimeException("Values don't match!");
    }
    duration = System.currentTimeMillis() - startTime;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.