android/guava/src/com/google/common/collect/Sets.java
@GwtIncompatible // NavigableSet
  public static <E> NavigableSet<E> synchronizedNavigableSet(NavigableSet<E> navigableSet) {
    return Synchronized.navigableSet(navigableSet);
  }
@GwtIncompatible // NavigableSet
  public static <E> NavigableSet<E> synchronizedNavigableSet(NavigableSet<E> navigableSet) {
    return Synchronized.navigableSet(navigableSet);
  }
Returns a synchronized (thread-safe) navigable set backed by the specified navigable set. In
order to guarantee serial access, it is critical that <b>all</b> access to the backing
navigable set is accomplished through the returned navigable set (or its views).

<p>It is imperative that the user manually synchronize on the returned sorted set when
iterating over it or any of its {@code descendingSet}, {@code subSet}, {@code headSet}, or
{@code tailSet} views.

<pre>{@code
NavigableSet<E> set = synchronizedNavigableSet(new TreeSet<E>());
...
synchronized (set) {
// Must be in the synchronized block
Iterator<E> it = set.iterator();
while (it.hasNext()) {
foo(it.next());
}
}
}</pre>

<p>or:

<pre>{@code
NavigableSet<E> set = synchronizedNavigableSet(new TreeSet<E>());
NavigableSet<E> set2 = set.descendingSet().headSet(foo);
...
synchronized (set) { // Note: set, not set2!!!
// Must be in the synchronized block
Iterator<E> it = set2.descendingIterator();
while (it.hasNext())
foo(it.next());
}
}
}</pre>

<p>Failure to follow this advice may result in non-deterministic behavior.

<p>The returned navigable set will be serializable if the specified navigable set is
serializable.

@param navigableSet the navigable set to be "wrapped" in a synchronized navigable set.
@return a synchronized view of the specified navigable set.
@since 13.0