### Question:
SequenceIdCollector { public boolean add(long sequenceId) { final Entry<Long, Long> floorEntry = processedInterval.floorEntry(sequenceId); if (isInClosedRange(floorEntry, sequenceId)) { return false; } final Entry<Long, Long> ceilingEntry = processedInterval.ceilingEntry(sequenceId); final boolean nextToFloor = isNextToClosedRange(floorEntry, sequenceId); final boolean nextToCeiling = isNextToClosedRange(ceilingEntry, sequenceId); if (nextToFloor && nextToCeiling) { processedInterval.remove(floorEntry.getKey()); processedInterval.remove(ceilingEntry.getKey()); processedInterval.put(floorEntry.getKey(), ceilingEntry.getValue()); } else if (nextToFloor) { processedInterval.remove(floorEntry.getKey()); processedInterval.put(floorEntry.getKey(), sequenceId); } else if (nextToCeiling) { processedInterval.remove(ceilingEntry.getKey()); processedInterval.put(sequenceId, ceilingEntry.getValue()); } else { processedInterval.put(sequenceId, sequenceId); } return true; }  boolean contains(long sequenceId); boolean add(long sequenceId); int size(); void clear(); @Override String toString();  }### Answer:
@Test public void testAddExistedElement() { assertTrue(sequenceIdCollector.add(10)); assertFalse(sequenceIdCollector.add(10)); }