IntervalMap implements TimeMap<Interval, T> { public boolean contains(double timestamp) { int realSize = size * 2; int index = Arrays.binarySearch(array, 0, realSize, timestamp); return index >= 0 && index < realSize; } IntervalMap();  IntervalMap(int capacity); protected  IntervalMap(double[] keys); @Override boolean put(Interval interval, T value); @Override boolean remove(Interval interval); @Override Object get(Interval interval, Estimator estimator); @Override T get(Interval interval, T defaultValue); @Override T[] toValuesArray(); @Override int size(); @Override boolean isEmpty(); boolean contains(double timestamp); @Override boolean contains(Interval interval); @Override Interval[] toKeysArray(); double[] getIntervals(); @Override void clear(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(TimeFormat timeFormat, DateTimeZone timeZone); @Override String toString(TimeFormat timeFormat); @Override String toString();  }
@Test public void testContains() { for (IntervalMap set : getAllInstances()) { Object[] defaultValues = getTestValues(set); Assert.assertFalse(set.contains(new Interval(1.0, 2.0))); set.put(new Interval(1.0, 2.0), defaultValues[0]); set.remove(new Interval(1.0, 2.0)); Assert.assertFalse(set.contains(new Interval(1.0, 2.0))); } }