Skip to content

Commit

Permalink
Add explicit type arguments necessary for J2KT in common/collect.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 540634196
  • Loading branch information
java-team-github-bot authored and Google Java Core Libraries committed Jun 15, 2023
1 parent 03e2792 commit 4b6460f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ abstract class AbstractNavigableMap<K extends @Nullable Object, V extends @Nulla
@Override
@CheckForNull
public Entry<K, V> firstEntry() {
return Iterators.getNext(entryIterator(), null);
return Iterators.<@Nullable Entry<K, V>>getNext(entryIterator(), null);
}

@Override
@CheckForNull
public Entry<K, V> lastEntry() {
return Iterators.getNext(descendingEntryIterator(), null);
return Iterators.<@Nullable Entry<K, V>>getNext(descendingEntryIterator(), null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public Entry<K, V> firstEntry() {
*/
@CheckForNull
protected Entry<K, V> standardFirstEntry() {
return Iterables.getFirst(entrySet(), null);
return Iterables.<@Nullable Entry<K, V>>getFirst(entrySet(), null);
}

/**
Expand Down Expand Up @@ -235,7 +235,7 @@ public Entry<K, V> lastEntry() {
*/
@CheckForNull
protected Entry<K, V> standardLastEntry() {
return Iterables.getFirst(descendingMap().entrySet(), null);
return Iterables.<@Nullable Entry<K, V>>getFirst(descendingMap().entrySet(), null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,29 +628,29 @@ abstract ImmutableSortedSet<E> subSetImpl(
@Override
@CheckForNull
public E lower(E e) {
return Iterators.getNext(headSet(e, false).descendingIterator(), null);
return Iterators.<@Nullable E>getNext(headSet(e, false).descendingIterator(), null);
}

/** @since 12.0 */
@Override
@CheckForNull
public E floor(E e) {
return Iterators.getNext(headSet(e, true).descendingIterator(), null);
return Iterators.<@Nullable E>getNext(headSet(e, true).descendingIterator(), null);
}

/** @since 12.0 */
@Override
@CheckForNull
public E ceiling(E e) {
return Iterables.getFirst(tailSet(e, true), null);
return Iterables.<@Nullable E>getFirst(tailSet(e, true), null);
}

/** @since 12.0 */
@GwtIncompatible // NavigableSet
@Override
@CheckForNull
public E higher(E e) {
return Iterables.getFirst(tailSet(e, false), null);
return Iterables.<@Nullable E>getFirst(tailSet(e, false), null);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions guava/src/com/google/common/collect/AbstractNavigableMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ abstract class AbstractNavigableMap<K extends @Nullable Object, V extends @Nulla
@Override
@CheckForNull
public Entry<K, V> firstEntry() {
return Iterators.getNext(entryIterator(), null);
return Iterators.<@Nullable Entry<K, V>>getNext(entryIterator(), null);
}

@Override
@CheckForNull
public Entry<K, V> lastEntry() {
return Iterators.getNext(descendingEntryIterator(), null);
return Iterators.<@Nullable Entry<K, V>>getNext(descendingEntryIterator(), null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public Entry<K, V> firstEntry() {
*/
@CheckForNull
protected Entry<K, V> standardFirstEntry() {
return Iterables.getFirst(entrySet(), null);
return Iterables.<@Nullable Entry<K, V>>getFirst(entrySet(), null);
}

/**
Expand Down Expand Up @@ -236,7 +236,7 @@ public Entry<K, V> lastEntry() {
*/
@CheckForNull
protected Entry<K, V> standardLastEntry() {
return Iterables.getFirst(descendingMap().entrySet(), null);
return Iterables.<@Nullable Entry<K, V>>getFirst(descendingMap().entrySet(), null);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions guava/src/com/google/common/collect/ImmutableSortedSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -696,29 +696,29 @@ abstract ImmutableSortedSet<E> subSetImpl(
@Override
@CheckForNull
public E lower(E e) {
return Iterators.getNext(headSet(e, false).descendingIterator(), null);
return Iterators.<@Nullable E>getNext(headSet(e, false).descendingIterator(), null);
}

/** @since 12.0 */
@Override
@CheckForNull
public E floor(E e) {
return Iterators.getNext(headSet(e, true).descendingIterator(), null);
return Iterators.<@Nullable E>getNext(headSet(e, true).descendingIterator(), null);
}

/** @since 12.0 */
@Override
@CheckForNull
public E ceiling(E e) {
return Iterables.getFirst(tailSet(e, true), null);
return Iterables.<@Nullable E>getFirst(tailSet(e, true), null);
}

/** @since 12.0 */
@GwtIncompatible // NavigableSet
@Override
@CheckForNull
public E higher(E e) {
return Iterables.getFirst(tailSet(e, false), null);
return Iterables.<@Nullable E>getFirst(tailSet(e, false), null);
}

@Override
Expand Down

0 comments on commit 4b6460f

Please sign in to comment.