Have you considered returning Set< IndexDescriptor > instead? You could then return an empty Set for non-indexed types, and also simplify the IndexDescriptor as it would not need to have different methods for sharded or non-sharded usage.