Skip to content

Commit

Permalink
Add missing nullable declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Apr 26, 2019
1 parent f8dc852 commit 3d502d9
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable

private final Locale locale;

@Nullable
private transient Set<String> keySet;

@Nullable
private transient Collection<V> values;

@Nullable
private transient Set<Entry<String, V>> entrySet;


Expand Down Expand Up @@ -320,6 +323,7 @@ protected boolean removeEldestEntry(Map.Entry<String, V> eldest) {
return false;
}

@Nullable
private String removeCaseInsensitiveKey(String key) {
return this.caseInsensitiveKeys.remove(convertKey(key));
}
Expand All @@ -329,12 +333,10 @@ private class KeySet extends AbstractSet<String> {

private final Set<String> delegate;


KeySet(Set<String> delegate) {
this.delegate = delegate;
}


@Override
public int size() {
return this.delegate.size();
Expand Down Expand Up @@ -369,20 +371,17 @@ public Spliterator<String> spliterator() {
public void forEach(Consumer<? super String> action) {
this.delegate.forEach(action);
}

}


private class Values extends AbstractCollection<V> {

private final Collection<V> delegate;


Values(Collection<V> delegate) {
this.delegate = delegate;
}


@Override
public int size() {
return this.delegate.size();
Expand Down Expand Up @@ -412,20 +411,17 @@ public Spliterator<V> spliterator() {
public void forEach(Consumer<? super V> action) {
this.delegate.forEach(action);
}

}


private class EntrySet extends AbstractSet<Entry<String, V>> {

private final Set<Entry<String, V>> delegate;


public EntrySet(Set<Entry<String, V>> delegate) {
this.delegate = delegate;
}


@Override
public int size() {
return this.delegate.size();
Expand All @@ -441,7 +437,6 @@ public Iterator<Entry<String, V>> iterator() {
return new EntrySetIterator();
}


@Override
@SuppressWarnings("unchecked")
public boolean remove(Object o) {
Expand All @@ -452,7 +447,6 @@ public boolean remove(Object o) {
return false;
}


@Override
public void clear() {
this.delegate.clear();
Expand All @@ -468,14 +462,14 @@ public Spliterator<Entry<String, V>> spliterator() {
public void forEach(Consumer<? super Entry<String, V>> action) {
this.delegate.forEach(action);
}

}


private class EntryIterator {

private final Iterator<Entry<String, V>> delegate;

@Nullable
private Entry<String, V> last;

public EntryIterator() {
Expand All @@ -494,12 +488,11 @@ public boolean hasNext() {

public void remove() {
this.delegate.remove();
if(this.last != null) {
if (this.last != null) {
removeCaseInsensitiveKey(this.last.getKey());
this.last = null;
}
}

}


Expand All @@ -509,7 +502,6 @@ private class KeySetIterator extends EntryIterator implements Iterator<String> {
public String next() {
return nextEntry().getKey();
}

}


Expand All @@ -519,7 +511,6 @@ private class ValuesIterator extends EntryIterator implements Iterator<V> {
public V next() {
return nextEntry().getValue();
}

}


Expand All @@ -529,7 +520,6 @@ private class EntrySetIterator extends EntryIterator implements Iterator<Entry<S
public Entry<String, V> next() {
return nextEntry();
}

}

}

0 comments on commit 3d502d9

Please sign in to comment.