static void iterateFromTest() {
    final ConcurrentDoubleOrderedListMap<String> map1 =
        new ConcurrentDoubleOrderedListMap<String>();
    map1.put(25, "25");
    map1.put(30, "30");
    map1.put(31, "31");
    DoubleObjectIterator<String> it = map1.iteratorFrom(21, false);
    double sum = 0;
    while (it.hasNext()) {
      it.next();
      sum += it.key();
    }
    it.cleanup();
    assert sum == 25 + 30 + 31;

    it = map1.iteratorFrom(25, false);
    sum = 0;
    while (it.hasNext()) {
      it.next();
      sum += it.key();
    }
    it.cleanup();
    assert sum == 30 + 31;

    it = map1.iteratorFrom(25, true);
    sum = 0;
    while (it.hasNext()) {
      it.next();
      sum += it.key();
    }
    it.cleanup();
    assert sum == 25 + 30 + 31;
  }
  static void iterTest() {
    iterateFromTest();

    final ConcurrentDoubleOrderedListMap<String> map = new ConcurrentDoubleOrderedListMap<String>();
    for (int i = -1000; i < 1001; i++) {
      map.put(i, "" + i);
    }

    DoubleObjectIterator<String> iter = map.iterator(11, 20, true, true);
    double sum = 0;
    while (iter.hasNext()) {
      iter.next();
      sum += iter.key();
    }
    assert sum == (11 + 20) * 5 : "sum:" + sum + ", != " + (11 + 20) * 5;

    iter = map.iterator(-1000, 1, true, false);
    sum = 0;
    while (iter.hasNext()) {
      iter.next();
      sum += iter.key();
    }
    assert sum == -1000 * (1000 + 1) / 2;

    iter = map.iterator(-1000, -995, true, true);
    sum = 0;
    while (iter.hasNext()) {
      iter.next();
      sum += iter.key();
    }
    assert sum == -(1000 + 999 + 998 + 997 + 996 + 995);

    iter = map.iteratorFrom(995, true);
    sum = 0;
    while (iter.hasNext()) {
      iter.next();
      sum += iter.key();
    }
    assert sum == (995 + 996 + 997 + 998 + 999 + 1000);

    iter = map.iteratorTo(-995, false);
    sum = 0;
    while (iter.hasNext()) {
      iter.next();
      sum += iter.key();
    }
    assert sum == -(1000 + 999 + 998 + 997 + 996);

    map.doSanityCheck();
    map.clear();
    System.out.println("done");
  }