InvertedIndexValueIterator<Value> () { if (myInputIdMapping == null) { //noinspection unchecked return (InvertedIndexValueIterator<Value>)EmptyValueIterator.INSTANCE; } Map<Value, Object> mapping = ObjectUtils.notNull(asMapping(), Collections.singletonMap(wrapValue(asValue()), myInputIdMappingValue)); return new InvertedIndexValueIterator<Value>() { private Value current; private Object currentValue; private final Iterator<Map.Entry<Value, Object>> iterator = mapping.entrySet().iterator(); @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Value next() { Map.Entry<Value, Object> entry = iterator.next(); current = entry.getKey(); Value next = current; currentValue = entry.getValue(); return unwrap(next); } @Override public @NotNull IntIterator getInputIdsIterator() { return getIntIteratorOutOfFileSetObject(getFileSetObject()); } @Override public @NotNull IntPredicate getValueAssociationPredicate() { return getPredicateOutOfFileSetObject(getFileSetObject()); } @Override public Object getFileSetObject() { if (current == null) throw new IllegalStateException(); return currentValue; } }; }