RBMBackedTimestampSet implements TimestampSet { @Override public long getNumberOfTimestamps() { return rbm.getCardinality(); } RBMBackedTimestampSet(final TimeBucket timeBucket);  RBMBackedTimestampSet(final TimeBucket timeBucket, final Instant... instants); @Override void add(final Instant instant); @Override void add(final Collection<Instant> instants); @Override SortedSet<Instant> getTimestamps(); @Override long getNumberOfTimestamps(); @Override Instant getEarliest(); @Override Instant getLatest(); void applyTimeRangeMask(final Long startMillis, final Long endMillis); TimeBucket getTimeBucket(); @JsonIgnore RoaringBitmap getRbm(); void setRbm(final RoaringBitmap rbm); void addAll(final RBMBackedTimestampSet other); @JsonIgnore RBMBackedTimestampSet getShallowClone(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testGetNumberOfTimestamps() { final RBMBackedTimestampSet timestampSet = new RBMBackedTimestampSet(TimeBucket.SECOND); timestampSet.add(instant1); timestampSet.add(instant1.plus(Duration.ofDays(100L))); timestampSet.add(instant1.plus(Duration.ofDays(200L))); timestampSet.add(instant1.plus(Duration.ofDays(300L))); timestampSet.add(instant1.plus(Duration.ofDays(300L)).plusMillis(1L)); final long numberOfTimestamps = timestampSet.getNumberOfTimestamps(); assertEquals(4, numberOfTimestamps); }