Skip to content

Commit

Permalink
SOLR-17623: fix case for contains(null)
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoh committed Jan 20, 2025
1 parent aeca5f9 commit eb9792c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang3.tuple.ImmutablePair;

Expand Down Expand Up @@ -107,7 +108,8 @@ public boolean containsKey(final Object key) {
public boolean containsValue(final Object value) {
int sz = size();
for (int i = 0; i < sz; i++) {
if (value.equals(getVal(i))) {
T val = getVal(i);
if (Objects.equals(value, val)) {
return true;
}
}
Expand Down Expand Up @@ -159,8 +161,8 @@ public Collection<T> values() {
@SuppressWarnings({"unchecked"})
public Set<Entry<String, T>> entrySet() {
var values = new HashSet<Entry<String, T>>();
for (int i = 0; i < nvPairs.size() - 1; i +=2) {
values.add(ImmutablePair.of((String) nvPairs.get(i), (T) nvPairs.get(i + 1)));
for (int i = 0; i < nvPairs.size() - 1; i += 2) {
values.add(ImmutablePair.of((String) nvPairs.get(i), (T) nvPairs.get(i + 1)));
}
return values;
}
Expand Down

0 comments on commit eb9792c

Please sign in to comment.