예제 #1
0
  @Test
  public void testIteration() {
    Map<Integer, Integer> input = new LinkedHashMap<>();

    input.put(1, 1);
    input.put(2, 2);
    input.put(3, 2);
    input.put(4, 4);
    input.put(5, 5);
    input.put(6, 5);
    input.put(7, 7);

    ImmutableSet<DummyValue> set = TrieSet.of();

    for (Entry<Integer, Integer> entry : input.entrySet()) {
      set = set.__insert(new DummyValue(entry.getKey(), entry.getValue()));
    }

    Set<Integer> keys = input.keySet();

    for (DummyValue key : set) {
      keys.remove(key.value);
    }

    assertTrue(keys.isEmpty());
  }
예제 #2
0
  @Test
  public void testValNodeVal() {
    Map<Integer, Integer> input = new LinkedHashMap<>();

    input.put(1, 1);
    input.put(2, 2);
    input.put(3, 2);
    input.put(4, 4);
    input.put(5, 5);
    input.put(6, 5);
    input.put(7, 7);

    ImmutableSet<DummyValue> set = TrieSet.of();

    for (Entry<Integer, Integer> entry : input.entrySet()) {
      set = set.__insert(new DummyValue(entry.getKey(), entry.getValue()));
    }

    for (Entry<Integer, Integer> entry : input.entrySet()) {
      assertTrue(set.contains(new DummyValue(entry.getKey(), entry.getValue())));
    }
  }