Code review comment: this is a double lookup in the map. Consider replacing with a single lookup

Code before review:
public ReadableState<Iterable<V>> get(K key) {
return new ReadableState<Iterable<V>>() {
final Object structuralKey = keyCoder.structuralValue(key);
@Override
public Iterable<V> read() {
KeyState keyState = keyStateMap.computeIfAbsent(structuralKey, k -> new KeyState(key));
if ((keyState.existence == KeyExistence.KNOWN_NONEXISTENT)
|| (allKeysKnown && keyState.existence == KeyExistence.UNKNOWN_EXISTENCE)) {
return Collections.emptyList();
}
if (localRemovals.contains(structuralKey)) {
if (localAdditions.containsKey(structuralKey)) {
return Iterables.unmodifiableIterable(localAdditions.get(structuralKey));
} else {
return Collections.emptyList();
}
}
if (keyState.valuesCached || complete) {
return Iterables.unmodifiableIterable(
Iterables.concat(keyState.values, localAdditions.get(structuralKey)));
}
Future<Iterable<V>> persistedData = getFutureForKey(key);
try (Closeable scope = scopedReadState()) {
final Iterable<V> persistedValues = persistedData.get();
if (Iterables.isEmpty(persistedValues)) {
Collection<V> local = localAdditions.get(structuralKey);
if (local.isEmpty()) {
keyState.existence = KeyExistence.KNOWN_NONEXISTENT;
return Collections.emptyList();
}
return Iterables.unmodifiableIterable(local);
}
if (persistedValues instanceof Weighted) {
keyState.existence = KeyExistence.KNOWN_EXIST;
keyState.valuesCached = true;
ConcatIterables<V> it = new ConcatIterables<>();
it.extendWith(persistedValues);
keyState.values = it;
}
return Iterables.unmodifiableIterable(
Iterables.concat(persistedValues, localAdditions.get(structuralKey)));
} catch (InterruptedException | ExecutionException | IOException e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
throw new RuntimeException("Unable to read Multimap state", e);
}
}
@Override
@SuppressWarnings("FutureReturnValueIgnored")
public ReadableState<Iterable<V>> readLater() {
WindmillMultimap.this.getFutureForKey(key);
return this;
}
};
}

Line under review: if (localAdditions.containsKey(structuralKey)) {

Code after addressing the review:
Override
public Iterable<V> read() {
KeyState keyState = null;
if (allKeysKnown) {
keyState = keyStateMap.get(structuralKey);
if (keyState == null || keyState.existence == KeyExistence.UNKNOWN_EXISTENCE) {
if (keyState != null) keyStateMap.remove(structuralKey);
return Collections.emptyList();
}
} else {
keyState = keyStateMap.computeIfAbsent(structuralKey, k -> new KeyState(key));
}
if (keyState.existence == KeyExistence.KNOWN_NONEXISTENT) {
return Collections.emptyList();
}
Iterable<V> localNewValues =
Iterables.limit(keyState.localAdditions, keyState.localAdditions.size());
if (keyState.removedLocally) {
return Iterables.unmodifiableIterable(localNewValues);
}
if (keyState.valuesCached || complete) {
return Iterables.unmodifiableIterable(
Iterables.concat(
Iterables.limit(keyState.values, keyState.valuesSize), localNewValues));
}
Future<Iterable<V>> persistedData = necessaryKeyEntriesFromStorageFuture(key);
try (Closeable scope = scopedReadState()) {
final Iterable<V> persistedValues = persistedData.get();
if (Iterables.isEmpty(persistedValues)) {
if (keyState.localAdditions.isEmpty()) {
keyState.existence = KeyExistence.KNOWN_NONEXISTENT;
return Collections.emptyList();
}
return Iterables.unmodifiableIterable(localNewValues);
}
keyState.existence = KeyExistence.KNOWN_EXIST;
if (persistedValues instanceof Weighted) {
keyState.valuesCached = true;
ConcatIterables<V> it = new ConcatIterables<>();
it.extendWith(persistedValues);
keyState.values = it;
keyState.valuesSize = Iterables.size(persistedValues);
}
return Iterables.unmodifiableIterable(
Iterables.concat(persistedValues, localNewValues));
} catch (InterruptedException | ExecutionException | IOException e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
throw new RuntimeException("Unable to read Multimap state", e);
}
}