1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | package Torello.Java.ReadOnly; import Torello.Java.Additional.RemoveUnsupportedIterator; import java.util.Collections; import java.util.Set; import java.util.Collection; import java.util.Comparator; import java.util.NavigableSet; import java.util.TreeSet; class JavaHTMLReadOnlyNavigableSet<E> implements ReadOnlyNavigableSet<E> { private final NavigableSet<E> ns; JavaHTMLReadOnlyNavigableSet(NavigableSet<E> ns) { this.ns = ns; } public E lower(E e) { return ns.lower(e); } public E floor(E e) { return ns.floor(e); }; public E ceiling(E e) { return ns.ceiling(e); } public E higher(E e) { return ns.higher(e); } public RemoveUnsupportedIterator<E> iterator() { return new RemoveUnsupportedIterator<>(ns.iterator()); } public ReadOnlyNavigableSet<E> descendingSet() { return new JavaHTMLReadOnlyNavigableSet<>(ns.descendingSet()); } public RemoveUnsupportedIterator<E> descendingIterator() { return new RemoveUnsupportedIterator<>(ns.descendingIterator()); } public ReadOnlyNavigableSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive ) { return new JavaHTMLReadOnlyNavigableSet<> (ns.subSet(fromElement, fromInclusive, toElement, toInclusive)); } public ReadOnlyNavigableSet<E> headSet(E toElement, boolean inclusive) { return new JavaHTMLReadOnlyNavigableSet<>(ns.headSet(toElement, inclusive)); } public ReadOnlyNavigableSet<E> tailSet(E fromElement, boolean inclusive) { return new JavaHTMLReadOnlyNavigableSet<>(ns.tailSet(fromElement, inclusive)); } public ReadOnlySortedSet<E> subSet(E fromElement, E toElement) { return new JavaHTMLReadOnlySortedSet<>(ns.subSet(fromElement, toElement)); } public ReadOnlySortedSet<E> headSet(E toElement) { return new JavaHTMLReadOnlySortedSet<>(ns.headSet(toElement)); } public ReadOnlySortedSet<E> tailSet(E fromElement) { return new JavaHTMLReadOnlySortedSet<>(ns.tailSet(fromElement)); } // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Block Copied from ReadOnlySortedSet // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** public Comparator<? super E> comparator() { return ns.comparator(); } public E first() { return ns.first(); } public E last() { return ns.last(); } public int size() { return ns.size(); } public boolean isEmpty() { return ns.isEmpty(); } public boolean contains(Object o) { return ns.contains(o); } public Object[] toArray() { return ns.toArray(); } public <T> T[] toArray(T[] a) { return ns.toArray(a); } public boolean containsAll(Collection<?> c) { return ns.containsAll(c); } // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // To Java-Collections Types // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // February 17th, 2025, The Java-HTML Difference @SuppressWarnings("unchecked") public Set<E> cloneToSet() { // if (s instanceof HashSet) return (Set<X>) ((HashSet<X>) ns).clone(); // if (s instanceof TreeSet) return (Set<X>) ((TreeSet<X>) ns).clone(); return new TreeSet<>(ns); } // February 17th, 2025, The Java-HTML Difference public Set<E> wrapToImmutableSet() { return Collections.unmodifiableNavigableSet(ns); } // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // java.lang.Object // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** public int hashCode() { return ns.hashCode(); } public boolean equals(Object other) { return ROHelperEquals.roSetEq(this, other); } public String toString() { return ns.toString(); } } |