Package Torello.Java.ReadOnly
Class ROTreeSetBuilder<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.TreeSet<E>
-
- Torello.Java.ReadOnly.ROTreeSetBuilder<E>
-
- Type Parameters:
E- the type of elements maintained by this set
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.NavigableSet<E>,java.util.Set<E>,java.util.SortedSet<E>
public final class ROTreeSetBuilder<E> extends java.util.TreeSet<E> implements java.lang.Cloneable, java.io.Serializable
This class was originally copied fromGitHub's Open-JDKAccount. Though the original file has been modified, few changes were applied to the Javadoc Commenting. Method and parameter names & types have not been modified whatsoever. This file may be viewed on the GitHub Archive for Java Packagejava.util.*
The Original'.java'Source-File's Header-Copyright Information is included here:File Copyright. Within that Copyright Notice, it is suggested that a copy of theGNU Public License V2also be included alongside.A Copy of Java'sTreeSetclass; used for building aReadOnlyTreeSet. Maintains an internal and inaccessibleTreeSet<E>instance. Upon build completion, this instance is passed to theReadOnlyVectorinstance and stored there.
The internal data-structure is not exposed by any method provided in this API. It is guaranteed that the contents of aReadOnlyVectorwill not be modified.
Note: The "RO Builder Classes" are somewhat superfluous (a little)
The art of any solid "Read-Only" Data-Structure Class-API is providing an intelligent means of actually inserting Data into a supposedly-read-only class. In this package, the most direct and efficient way of doing so is just to use one of the myriad constructors offered by the ReadOnly Data-Classes.
Another sound way of creating any "ReadOnly-XX" Data-Structure, is to simply populate the correspondingjava.util.XXclass instance, and pass that instance yourReadOnly-XConstructor. The constructor actuallycopiesthe data out of the original structure, and saves it to its own private & internal data-structure in order to guarantee the immutability contract.
But what about a situation where there is aVectorthat is being populated by a very large number elements? It would likely be of benefit to skip the data-copying step for performance reasons! If so, then a builder can improve performance quite a bit. The real value of using a "Builder" rather than one of theReadOnlyVectorconstructors is that this Builder'sbuild()method doesn't actually have any kind of data-copy step at all!
Also, of some interest, is that this class inherits the original Java-Classjava.util.Vector(explained further, below), making it extremely easy to use.
Inheritsjava.util.Vector
This class may be passed to any Data-Building Method that accepts aVector, because it inherits from that class. Any implementation that can populate aVectorcan also populate this builder.
Efficiency Improvement:
This class is nothing but a set of wrapper methods. It is being provided as an alternate, and possibly more efficient, way to construct aReadOnlyVector.
This class inherits the Standard JDK Collection-Framework Classjava.util.Vector, and adds a singlebooleanfield named'built'that, once switched to'true', will block any subsequent attempts to mutate the underlying data-structure.
With aVectorhaving more than, say, 10,000 items, the cost of copying the internalVector(which is necessary to construct any Read-Only Class) would perhaps be much too high. Instead, by making use of classROVectorBuilder, there is no need to run any kind of internal-data data-copying step at all.
Simply put all data into the Builder, using any / all standard Java-JDKVectormethods, and when thebuild()method is invoked, an internal flag is set which will wholly prohibit any further mutation of the data in your builder - thereby allowing the Builder, itself, to be used as theReadOnlyVector's internal Data-Structure.- See Also:
ReadOnlyTreeSet, Serialized Form
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ROTreeSetBuilder.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ROTreeSetBuilder.java
File Size: 21,264 Bytes Line Count: 477 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field Description protected static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description ROTreeSetBuilder()Constructs a new, empty tree set, sorted according to the natural ordering of its elements.ROTreeSetBuilder(Collection<? extends E> c)Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.ROTreeSetBuilder(Comparator<? super E> comparator)Constructs a new, empty tree set, sorted according to the specified comparator.ROTreeSetBuilder(SortedSet<E> s)Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.
-
Method Summary
Convert this Builder into a ReadOnlyTreeSet Instance Modifier and Type Method Description ReadOnlyTreeSet<E>build()Simply transfers'this'instance' internalTreeSetto theReadOnlyTreeSetWrapper-Class.Add Items to this Read-Only-Set Builder Modifier and Type Method Description booleanadd(E e)Adds the specified element to this set if it is not already present.booleanaddAll(Collection<? extends E> c)Adds all of the elements in the specified collection to this set.Remove Items from this Read-Only-Set Builder Modifier and Type Method Description voidclear()Removes all of the elements from this set.booleanremove(Object o)Removes the specified element from this set if it is present.booleanremoveAll(Collection<?> c)booleanremoveIf(Predicate<? super E> filter)booleanretainAll(Collection<?> c)Poll (Remove & Return) Set Elements Modifier and Type Method Description EpollFirst()Retrieves and removes the first (lowest) element, or returns null if this set is empty.EpollLast()Retrieves and removes the last (highest) element, or returns null if this set is empty.Mutable / Read-Write View Generators - Return Instances with Unmodifiable-Wrappers Modifier and Type Method Description NavigableSet<E>descendingSet()Restricted-Access InstanceSortedSet<E>headSet(E toElement)Restricted-Access InstanceNavigableSet<E>headSet(E toElement, boolean inclusive)Restricted-Access InstanceNavigableSet<E>subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)Restricted-Access InstanceSortedSet<E>subSet(E fromElement, E toElement)Restricted-Access InstanceSortedSet<E>tailSet(E fromElement)Restricted-Access InstanceNavigableSet<E>tailSet(E fromElement, boolean inclusive)Restricted-Access InstanceMethods: class java.lang.Object Modifier and Type Method Description booleanequals(Object o)Compares the specified Object with this Builder for equality, as per the definition in the private and internal field'treeSet'.Methods: interface java.lang.Iterable Modifier and Type Method Description RemoveUnsupportedIterator<E>descendingIterator()Restricted-Access InstanceRemoveUnsupportedIterator<E>iterator()Restricted-Access InstanceMethods: interface java.lang.Cloneable Modifier and Type Method Description ROTreeSetBuilder<E>clone()Clones this instance' ofROTreeSetBuilder.-
Methods inherited from class java.util.TreeSet
ceiling, comparator, contains, first, floor, higher, isEmpty, last, lower, size, spliterator
-
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable. Using theSerializableImplementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final long serialVersionUID = 1;
-
-
Constructor Detail
-
ROTreeSetBuilder
public ROTreeSetBuilder()
Constructs a new, empty tree set, sorted according to the natural ordering of its elements. All elements inserted into the set must implement theComparableinterface. Furthermore, all such elements must be mutually comparable:e1.compareTo(e2)must not throw aClassCastExceptionfor any elementse1ande2in the set. If the user attempts to add an element to the set that violates this constraint (for example, the user attempts to add a string element to a set whose elements are integers), theaddcall will throw aClassCastException.- Code:
- Exact Constructor Body:
super();
-
ROTreeSetBuilder
public ROTreeSetBuilder(java.util.Comparator<? super E> comparator)
Constructs a new, empty tree set, sorted according to the specified comparator. All elements inserted into the set must be mutually comparable by the specified comparator:comparator.compare(e1, e2)must not throw aClassCastExceptionfor any elementse1ande2in the set. If the user attempts to add an element to the set that violates this constraint, theaddcall will throw aClassCastException.- Parameters:
comparator- the comparator that will be used to order this set. Ifnull, the natural ordering of the elements will be used.- Code:
- Exact Constructor Body:
super(comparator);
-
ROTreeSetBuilder
public ROTreeSetBuilder(java.util.Collection<? extends E> c)
Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements. All elements inserted into the set must implement theComparableinterface. Furthermore, all such elements must be mutually comparable:e1.compareTo(e2)must not throw aClassCastExceptionfor any elementse1ande2in the set.- Parameters:
c- collection whose elements will comprise the new set- Throws:
java.lang.ClassCastException- if the elements incare notComparable, or are not mutually comparablejava.lang.NullPointerException- if the specified collection is null- Code:
- Exact Constructor Body:
super(c);
-
ROTreeSetBuilder
public ROTreeSetBuilder(java.util.SortedSet<E> s)
Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.- Parameters:
s- sorted set whose elements will comprise the new set- Throws:
java.lang.NullPointerException- if the specified sorted set is null- Code:
- Exact Constructor Body:
super(s);
-
-
Method Detail
-
build
public ReadOnlyTreeSet<E> build()
Simply transfers'this'instance' internalTreeSetto theReadOnlyTreeSetWrapper-Class.- Returns:
- a newly constructed
ReadOnlyTreeSet"Wrapper-Class", shielding the internal'treeSet'private-field from any modification. - Code:
- Exact Method Body:
this.built = true; return (size() == 0) ? ReadOnlyTreeSet.emptyROTS() : new ReadOnlyTreeSet<E>(this, friendClassBadge);
-
iterator
public RemoveUnsupportedIterator<E> iterator()
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedxxin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisxx(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.- Specified by:
iteratorin interfacejava.util.Collection<E>- Specified by:
iteratorin interfacejava.lang.Iterable<E>- Specified by:
iteratorin interfacejava.util.NavigableSet<E>- Specified by:
iteratorin interfacejava.util.Set<E>- Overrides:
iteratorin classjava.util.TreeSet<E>- Returns:
- a
java.util.Iteratorthat cannot modify thisVector-Builder - Code:
- Exact Method Body:
return new RemoveUnsupportedIterator<>(super.iterator());
-
descendingIterator
public RemoveUnsupportedIterator<E> descendingIterator()
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedxxin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisxx(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.
-
add
public boolean add(E e)
Adds the specified element to this set if it is not already present. More formally, adds the specified elementeto this set if the set contains no elemente2such thatObjects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returnsFALSE.
Mutator Method:
This method modifies the contents of this class' internalTreeMap. Note that any method which modifies this internalTreeMapfield will throw an exception if invoked after a call tobuild().- Specified by:
addin interfacejava.util.Collection<E>- Specified by:
addin interfacejava.util.Set<E>- Overrides:
addin classjava.util.TreeSet<E>- Parameters:
e- element to be added to this set- Returns:
TRUEif this set did not already contain the specified element- Throws:
java.lang.ClassCastException- if the specified object cannot be compared with the elements currently in this setjava.lang.NullPointerException- if the specified element is null and this set uses natural ordering, or its comparator does not permit null elements- Code:
- Exact Method Body:
if (this.built) throw new AttemptedModificationException(ROTS); return super.add(e);
-
remove
public boolean remove(java.lang.Object o)
Removes the specified element from this set if it is present. More formally, removes an elementesuch thatObjects.equals(o, e), if this set contains such an element. ReturnsTRUEif this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)
Mutator Method:
This method modifies the contents of this class' internalTreeMap. Note that any method which modifies this internalTreeMapfield will throw an exception if invoked after a call tobuild().- Specified by:
removein interfacejava.util.Collection<E>- Specified by:
removein interfacejava.util.Set<E>- Overrides:
removein classjava.util.TreeSet<E>- Parameters:
o- object to be removed from this set, if present- Returns:
TRUEif this set contained the specified element- Throws:
java.lang.ClassCastException- if the specified object cannot be compared with the elements currently in this setjava.lang.NullPointerException- if the specified element is null and this set uses natural ordering, or its comparator does not permit null elements- Code:
- Exact Method Body:
if (this.built) throw new AttemptedModificationException(ROTS); return super.remove(o);
-
clear
public void clear()
Removes all of the elements from this set. The set will be empty after this call returns.
Mutator Method:
This method modifies the contents of this class' internalTreeMap. Note that any method which modifies this internalTreeMapfield will throw an exception if invoked after a call tobuild().
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
Adds all of the elements in the specified collection to this set.
Mutator Method:
This method modifies the contents of this class' internalTreeMap. Note that any method which modifies this internalTreeMapfield will throw an exception if invoked after a call tobuild().- Specified by:
addAllin interfacejava.util.Collection<E>- Specified by:
addAllin interfacejava.util.Set<E>- Overrides:
addAllin classjava.util.TreeSet<E>- Parameters:
c- collection containing elements to be added to this set- Returns:
TRUEif this set changed as a result of the call- Throws:
java.lang.ClassCastException- if the elements provided cannot be compared with the elements currently in the setjava.lang.NullPointerException- if the specified collection is null or if any element is null and this set uses natural ordering, or its comparator does not permit null elements- Code:
- Exact Method Body:
if (this.built) throw new AttemptedModificationException(ROTS); return super.addAll(c);
-
pollFirst
public E pollFirst()
Retrieves and removes the first (lowest) element, or returns null if this set is empty.
Mutator Method:
This method modifies the contents of this class' internalTreeMap. Note that any method which modifies this internalTreeMapfield will throw an exception if invoked after a call tobuild().
-
pollLast
public E pollLast()
Retrieves and removes the last (highest) element, or returns null if this set is empty.
Mutator Method:
This method modifies the contents of this class' internalTreeMap. Note that any method which modifies this internalTreeMapfield will throw an exception if invoked after a call tobuild().
-
descendingSet
public java.util.NavigableSet<E> descendingSet()
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedNavigableSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisNavigableSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.
-
headSet
public java.util.SortedSet<E> headSet(E toElement)
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedSortedSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisSortedSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.- Specified by:
headSetin interfacejava.util.NavigableSet<E>- Specified by:
headSetin interfacejava.util.SortedSet<E>- Overrides:
headSetin classjava.util.TreeSet<E>- Returns:
- a
java.util.SortedSetthat cannot modify thisTreeSet-Builder - Code:
- Exact Method Body:
return Collections.unmodifiableSortedSet(super.headSet(toElement, false));
-
headSet
public java.util.NavigableSet<E> headSet(E toElement, boolean inclusive)
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedNavigableSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisNavigableSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.
-
subSet
public java.util.NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedNavigableSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisNavigableSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.- Specified by:
subSetin interfacejava.util.NavigableSet<E>- Overrides:
subSetin classjava.util.TreeSet<E>- Returns:
- a
java.util.NavigableSetthat cannot modify thisTreeSet-Builder - Code:
- Exact Method Body:
return Collections.unmodifiableNavigableSet (super.subSet(fromElement, fromInclusive, toElement, toInclusive));
-
subSet
public java.util.SortedSet<E> subSet(E fromElement, E toElement)
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedSortedSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisSortedSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.- Specified by:
subSetin interfacejava.util.NavigableSet<E>- Specified by:
subSetin interfacejava.util.SortedSet<E>- Overrides:
subSetin classjava.util.TreeSet<E>- Returns:
- a
java.util.SortedSetthat cannot modify thisTreeSet-Builder - Code:
- Exact Method Body:
return Collections.unmodifiableSortedSet (super.subSet(fromElement, true, toElement, false));
-
tailSet
public java.util.NavigableSet<E> tailSet(E fromElement, boolean inclusive)
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedNavigableSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisNavigableSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.
-
tailSet
public java.util.SortedSet<E> tailSet(E fromElement)
Restricts a back-door into the underlying data-structure.
UnsupportedOperationException Specifics:
This method invokes the Java StandardCollectionsclass static-method for 'wrapping' this method's returnedSortedSetin an Immutable-Wrapper. Java's Collections Framework Immutable-Wrappers have been around since prior to JDK 8, and are easy to use. The wrapper utilized here is needed because this particular method returns a Read-Write "View" into the underlyingVectorthat facilitates modifying data inside this class' instances.
Once'this'builder instance has been built into a Read-Only Data-Structure, thisSortedSet(which possesses methods for mutating theVector) would provide a potential back-door for breaking the Immutable-Contract of theReadOnlyVectorthat is ultimately built.
Remember that all sub-sets and sub-maps returned by the Java Collections Framework guarantee that any changes to the sub-set or sub-map will be reflected and translated back into the originalCollectionfrom whence they were created.
The returned instance is usable, but any method that would modify thisVector-Builder will, instead, throw a JavaUnsupportedOperationException.- Specified by:
tailSetin interfacejava.util.NavigableSet<E>- Specified by:
tailSetin interfacejava.util.SortedSet<E>- Overrides:
tailSetin classjava.util.TreeSet<E>- Returns:
- a
java.util.SortedSetthat cannot modify thisTreeSet-Builder - Code:
- Exact Method Body:
return Collections.unmodifiableSortedSet(super.tailSet(fromElement, true));
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
removeIf
-
equals
public boolean equals(java.lang.Object o)
Compares the specified Object with this Builder for equality, as per the definition in the private and internal field'treeSet'.- Specified by:
equalsin interfacejava.util.Collection<E>- Specified by:
equalsin interfacejava.util.Set<E>- Overrides:
equalsin classjava.util.AbstractSet<E>- Parameters:
o- object to be compared for equality with thisROTreeSetBuilderinstance- Returns:
- true if the specified Object is equal to this Builder
- Code:
- Exact Method Body:
if (this == o) return true; if (! (o instanceof ROTreeSetBuilder)) return false; return super.equals((TreeSet) o);
-
clone
public ROTreeSetBuilder<E> clone()
Clones this instance' ofROTreeSetBuilder.
The clone that's returned has had it's internal'built'boolean-flag setFALSE- Overrides:
clonein classjava.util.TreeSet<E>- Returns:
- a clone of this builder
- Code:
- Exact Method Body:
return new ROTreeSetBuilder<>(this);
-
-