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-JDK
Account. 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 V2
also be included alongside.A Copy of Java'sTreeSet
class; used for building aReadOnlyTreeSet
. Maintains an internal and inaccessibleTreeSet<E>
instance. Upon build completion, this instance is passed to theReadOnlyVector
instance and stored there.
The internal data-structure is not exposed by any method provided in this API. It is guaranteed that the contents of aReadOnlyVector
will 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.XX
class instance, and pass that instance yourReadOnly-X
Constructor. The constructor actuallycopies
the 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 aVector
that 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 theReadOnlyVector
constructors 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 aVector
can 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 singleboolean
field named'built'
that, once switched to'true'
, will block any subsequent attempts to mutate the underlying data-structure.
With aVector
having 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-JDKVector
methods, 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,252 Bytes Line Count: 477 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field Description protected static long
serialVersionUID
-
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 ReadOnlyTreeSet<E>
build()
Simply transfers'this'
instance' internalTreeSet
to theReadOnlyTreeSet
Wrapper-Class.Add Items to this Read-Only-Set Builder Modifier and Type Method boolean
add(E e)
Adds the specified element to this set if it is not already present.boolean
addAll(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 void
clear()
Removes all of the elements from this set.boolean
remove(Object o)
Removes the specified element from this set if it is present.boolean
removeAll(Collection<?> c)
boolean
removeIf(Predicate<? super E> filter)
boolean
retainAll(Collection<?> c)
Poll (Remove & Return) Set Elements Modifier and Type Method E
pollFirst()
Retrieves and removes the first (lowest) element, or returns null if this set is empty.E
pollLast()
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 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 boolean
equals(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 RemoveUnsupportedIterator<E>
descendingIterator()
Restricted-Access InstanceRemoveUnsupportedIterator<E>
iterator()
Restricted-Access InstanceMethods: interface java.lang.Cloneable Modifier and Type Method 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 theSerializable
Implementation 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 theComparable
interface. Furthermore, all such elements must be mutually comparable:e1.compareTo(e2)
must not throw aClassCastException
for any elementse1
ande2
in 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), theadd
call will throw aClassCastException
.
-
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 aClassCastException
for any elementse1
ande2
in the set. If the user attempts to add an element to the set that violates this constraint, theadd
call 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 theComparable
interface. Furthermore, all such elements must be mutually comparable:e1.compareTo(e2)
must not throw aClassCastException
for any elementse1
ande2
in the set.- Parameters:
c
- collection whose elements will comprise the new set- Throws:
java.lang.ClassCastException
- if the elements inc
are 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' internalTreeSet
to theReadOnlyTreeSet
Wrapper-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 StandardCollections
class static-method for 'wrapping' this method's returnedxx
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from whence they were created.
The returned instance is usable, but any method that would modify thisVector
-Builder will, instead, throw a JavaUnsupportedOperationException
.- Specified by:
iterator
in interfacejava.util.Collection<E>
- Specified by:
iterator
in interfacejava.lang.Iterable<E>
- Specified by:
iterator
in interfacejava.util.NavigableSet<E>
- Specified by:
iterator
in interfacejava.util.Set<E>
- Overrides:
iterator
in classjava.util.TreeSet<E>
- Returns:
- a
java.util.Iterator
that 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 StandardCollections
class static-method for 'wrapping' this method's returnedxx
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from 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 elemente
to this set if the set contains no elemente2
such 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 internalTreeMap
field will throw an exception if invoked after a call tobuild()
.- Specified by:
add
in interfacejava.util.Collection<E>
- Specified by:
add
in interfacejava.util.Set<E>
- Overrides:
add
in classjava.util.TreeSet<E>
- Parameters:
e
- element to be added to this set- Returns:
TRUE
if 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 elemente
such thatObjects.equals(o, e)
, if this set contains such an element. ReturnsTRUE
if 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 internalTreeMap
field will throw an exception if invoked after a call tobuild()
.- Specified by:
remove
in interfacejava.util.Collection<E>
- Specified by:
remove
in interfacejava.util.Set<E>
- Overrides:
remove
in classjava.util.TreeSet<E>
- Parameters:
o
- object to be removed from this set, if present- Returns:
TRUE
if 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 internalTreeMap
field 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 internalTreeMap
field will throw an exception if invoked after a call tobuild()
.- Specified by:
addAll
in interfacejava.util.Collection<E>
- Specified by:
addAll
in interfacejava.util.Set<E>
- Overrides:
addAll
in classjava.util.TreeSet<E>
- Parameters:
c
- collection containing elements to be added to this set- Returns:
TRUE
if 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 internalTreeMap
field 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 internalTreeMap
field 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 StandardCollections
class static-method for 'wrapping' this method's returnedNavigableSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from 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 StandardCollections
class static-method for 'wrapping' this method's returnedSortedSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from whence they were created.
The returned instance is usable, but any method that would modify thisVector
-Builder will, instead, throw a JavaUnsupportedOperationException
.- Specified by:
headSet
in interfacejava.util.NavigableSet<E>
- Specified by:
headSet
in interfacejava.util.SortedSet<E>
- Overrides:
headSet
in classjava.util.TreeSet<E>
- Returns:
- a
java.util.SortedSet
that 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 StandardCollections
class static-method for 'wrapping' this method's returnedNavigableSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from 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 StandardCollections
class static-method for 'wrapping' this method's returnedNavigableSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from whence they were created.
The returned instance is usable, but any method that would modify thisVector
-Builder will, instead, throw a JavaUnsupportedOperationException
.- Specified by:
subSet
in interfacejava.util.NavigableSet<E>
- Overrides:
subSet
in classjava.util.TreeSet<E>
- Returns:
- a
java.util.NavigableSet
that 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 StandardCollections
class static-method for 'wrapping' this method's returnedSortedSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from whence they were created.
The returned instance is usable, but any method that would modify thisVector
-Builder will, instead, throw a JavaUnsupportedOperationException
.- Specified by:
subSet
in interfacejava.util.NavigableSet<E>
- Specified by:
subSet
in interfacejava.util.SortedSet<E>
- Overrides:
subSet
in classjava.util.TreeSet<E>
- Returns:
- a
java.util.SortedSet
that 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 StandardCollections
class static-method for 'wrapping' this method's returnedNavigableSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from 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 StandardCollections
class static-method for 'wrapping' this method's returnedSortedSet
in 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 underlyingVector
that 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 theReadOnlyVector
that 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 originalCollection
from whence they were created.
The returned instance is usable, but any method that would modify thisVector
-Builder will, instead, throw a JavaUnsupportedOperationException
.- Specified by:
tailSet
in interfacejava.util.NavigableSet<E>
- Specified by:
tailSet
in interfacejava.util.SortedSet<E>
- Overrides:
tailSet
in classjava.util.TreeSet<E>
- Returns:
- a
java.util.SortedSet
that 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:
equals
in interfacejava.util.Collection<E>
- Specified by:
equals
in interfacejava.util.Set<E>
- Overrides:
equals
in classjava.util.AbstractSet<E>
- Parameters:
o
- object to be compared for equality with thisROTreeSetBuilder
instance- 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:
clone
in classjava.util.TreeSet<E>
- Returns:
- a clone of this builder
- Code:
- Exact Method Body:
return new ROTreeSetBuilder<>(this);
-
-