NavigableIndex extends AbstractMapBasedAttributeIndex<A, O, ConcurrentNavigableMap<A, StoredResultSet<O>>> implements SortedKeyStatisticsAttributeIndex<A, O>, OnHeapTypeIndex { @Override public CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeys(QueryOptions queryOptions) { return super.getStatisticsForDistinctKeys(queryOptions); } protected  NavigableIndex(Factory<ConcurrentNavigableMap<A, StoredResultSet<O>>> indexMapFactory, Factory<StoredResultSet<O>> valueSetFactory, Attribute<O, A> attribute); @Override boolean isMutable(); @Override Index<O> getEffectiveIndex(); @Override ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions); @Override CloseableIterable<A> getDistinctKeys(QueryOptions queryOptions); @Override CloseableIterable<A> getDistinctKeys(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions); @Override CloseableIterable<A> getDistinctKeysDescending(QueryOptions queryOptions); @Override CloseableIterable<A> getDistinctKeysDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions); @Override Integer getCountForKey(A key, QueryOptions queryOptions); @Override Integer getCountOfDistinctKeys(QueryOptions queryOptions); @Override CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeys(QueryOptions queryOptions); @Override CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeysDescending(final QueryOptions queryOptions); @Override CloseableIterable<KeyValue<A, O>> getKeysAndValues(QueryOptions queryOptions); @Override CloseableIterable<KeyValue<A, O>> getKeysAndValues(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions); @Override CloseableIterable<KeyValue<A, O>> getKeysAndValuesDescending(QueryOptions queryOptions); @Override CloseableIterable<KeyValue<A, O>> getKeysAndValuesDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions); static NavigableIndex<A, O> onAttribute(Attribute<O, A> attribute); static NavigableIndex<A, O> onAttribute(Factory<ConcurrentNavigableMap<A, StoredResultSet<O>>> indexMapFactory, Factory<StoredResultSet<O>> valueSetFactory, Attribute<O, A> attribute); static NavigableIndex<A, O> withQuantizerOnAttribute(final Quantizer<A> quantizer, Attribute<O, A> attribute); static NavigableIndex<A, O> withQuantizerOnAttribute(Factory<ConcurrentNavigableMap<A, StoredResultSet<O>>> indexMapFactory, Factory<StoredResultSet<O>> valueSetFactory, final Quantizer<A> quantizer, Attribute<O, A> attribute);  }
@Test public void testGetStatisticsForDistinctKeys(){ IndexedCollection<Car> collection = new ConcurrentIndexedCollection<Car>(); KeyStatisticsIndex<String, Car> MANUFACTURER_INDEX = NavigableIndex.onAttribute(Car.MANUFACTURER); collection.addIndex(MANUFACTURER_INDEX); collection.addAll(CarFactory.createCollectionOfCars(20)); Set<KeyStatistics<String>> keyStatistics = setOf(MANUFACTURER_INDEX.getStatisticsForDistinctKeys(noQueryOptions())); Assert.assertEquals(setOf( new KeyStatistics<String>("Ford", 6), new KeyStatistics<String>("Honda", 6), new KeyStatistics<String>("Toyota", 6), new KeyStatistics<String>("BMW", 2) ), keyStatistics); }