@Override <E> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } }
@Override <E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else if (collection instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } else { return Collections.unmodifiableSet((Set<E>) collection); } }
@Override <E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else if (collection instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } else if (collection instanceof Set) { return Collections.unmodifiableSet((Set<E>) collection); } else if (collection instanceof List) { return Collections.unmodifiableList((List<E>) collection); } else { return Collections.unmodifiableCollection(collection); } }
@Override <E> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } }
@Override public NavigableSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { return unmodifiableNavigableSet( delegate.subSet(fromElement, fromInclusive, toElement, toInclusive)); }
@Override public NavigableSet<E> headSet(E toElement, boolean inclusive) { return unmodifiableNavigableSet(delegate.headSet(toElement, inclusive)); }
@Override public NavigableSet<K> navigableKeySet() { return Sets.unmodifiableNavigableSet(delegate.navigableKeySet()); }
@Override public NavigableSet<K> descendingKeySet() { return Sets.unmodifiableNavigableSet(delegate.descendingKeySet()); }
@Override <E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else if (collection instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } else { return Collections.unmodifiableSet((Set<E>) collection); } }
@Override public NavigableSet<E> tailSet(E fromElement, boolean inclusive) { return unmodifiableNavigableSet(delegate.tailSet(fromElement, inclusive)); }
@Override <E> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } }
@Override <E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else if (collection instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } else { return Collections.unmodifiableSet((Set<E>) collection); } }
@Override <E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) { if (collection instanceof NavigableSet) { return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection); } else if (collection instanceof SortedSet) { return Collections.unmodifiableSortedSet((SortedSet<E>) collection); } else if (collection instanceof Set) { return Collections.unmodifiableSet((Set<E>) collection); } else if (collection instanceof List) { return Collections.unmodifiableList((List<E>) collection); } else { return Collections.unmodifiableCollection(collection); } }
@Override NavigableSet<E> createElementSet() { return Sets.unmodifiableNavigableSet(delegate().elementSet()); }
@Override public NavigableSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { return unmodifiableNavigableSet( delegate.subSet(fromElement, fromInclusive, toElement, toInclusive)); }
@Override public NavigableSet<K> navigableKeySet() { return Sets.unmodifiableNavigableSet(delegate.navigableKeySet()); }
@Override public NavigableSet<K> descendingKeySet() { return Sets.unmodifiableNavigableSet(delegate.descendingKeySet()); }
@Override protected Set<String> create(String[] elements) { SafeTreeSet<String> set = new SafeTreeSet<>(Arrays.asList(elements)); return Sets.unmodifiableNavigableSet(set); }
@Override NavigableSet<E> createElementSet() { return Sets.unmodifiableNavigableSet(delegate().elementSet()); }
mod.add(3); NavigableSet<Integer> unmod = unmodifiableNavigableSet(mod);