IntervalSet implements TimeSet<Interval> { public boolean contains(double timestamp) { int realSize = size * 2; int index = Arrays.binarySearch(array, 0, realSize, timestamp); return index >= 0 && index < realSize; } IntervalSet();  IntervalSet(int capacity);  IntervalSet(double[] arr); @Override boolean add(Interval interval); @Override boolean remove(Interval interval); @Override int size(); @Override boolean isEmpty(); boolean contains(double timestamp); @Override boolean contains(Interval interval); double[] getIntervals(); @Override Interval[] toArray(); @Override Object toPrimitiveArray(); @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() { IntervalSet set = new IntervalSet(); set.add(new Interval(4.0, 5.0)); Assert.assertTrue(set.contains(new Interval(4.0, 5.0))); Assert.assertFalse(set.contains(new Interval(0.0, 1.0))); Assert.assertFalse(set.contains(new Interval(0.0, 4.0))); Assert.assertFalse(set.contains(new Interval(4.0, 4.0))); Assert.assertFalse(set.contains(new Interval(5.0, 5.0))); Assert.assertFalse(set.contains(new Interval(5.0, 6.0))); Assert.assertFalse(set.contains(new Interval(4.0, 7.0))); Assert.assertFalse(set.contains(new Interval(3.0, 5.0))); }