SortedAttributeMetadata extends AttributeMetadata<A, O> { @Override public Integer getCountOfDistinctKeys() { return super.getCountOfDistinctKeys(); } SortedAttributeMetadata(SortedKeyStatisticsIndex<A, O> index, Supplier<QueryOptions> openResourcesHandler, Consumer<QueryOptions> closeResourcesHandler); @Override Stream<KeyFrequency<A>> getFrequencyDistribution(); Stream<KeyFrequency<A>> getFrequencyDistributionDescending(); @Override Stream<A> getDistinctKeys(); Stream<A> getDistinctKeysDescending(); Stream<A> getDistinctKeys(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive); Stream<A> getDistinctKeysDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive); @Override Integer getCountOfDistinctKeys(); @Override Integer getCountForKey(A key); @Override Stream<KeyValue<A, O>> getKeysAndValues(); Stream<KeyValue<A, O>> getKeysAndValuesDescending(); Stream<KeyValue<A, O>> getKeysAndValues(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive); Stream<KeyValue<A, O>> getKeysAndValuesDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive);  }
@Test public void testGetCountOfDistinctKeys() { IndexedCollection<Car> cars = createIndexedCollectionOfCars(20); cars.addIndex(NavigableIndex.onAttribute(Car.MANUFACTURER)); MetadataEngine<Car> metadataEngine = cars.getMetadataEngine(); SortedAttributeMetadata<String, Car> sortedAttributeMetadata = metadataEngine.getSortedAttributeMetadata(Car.MANUFACTURER); assertEquals(Integer.valueOf(4), sortedAttributeMetadata.getCountOfDistinctKeys()); }