E - The type of the elements in the tree.public final class RandomizedTree<E>
extends java.util.AbstractCollection<E>
implements java.lang.Cloneable
| Constructor and Description |
|---|
RandomizedTree()
This default constructor creates an instance of a tree that does not allow duplicate
elements and uses the default comparison mechanism.
|
RandomizedTree(boolean duplicatesAllowed)
This constructor creates an instance of a tree that uses the default comparison
mechanism and allows the caller to specify whether duplicates are allowed.
|
RandomizedTree(boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
This constructor creates an instance of a tree that uses the specified comparator
for ordering the elements in the tree and allows the caller to specify whether
duplicates are allowed.
|
RandomizedTree(java.util.Collection<? extends E> elements)
This constructor creates an instance of a tree that does not allow duplicate
elements and uses the default comparison mechanism.
|
RandomizedTree(java.util.Collection<? extends E> elements,
boolean duplicatesAllowed)
This constructor creates an instance of a tree that uses the default comparison
mechanism and allows the caller to specify whether duplicates are allowed.
|
RandomizedTree(java.util.Collection<? extends E> elements,
boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
This constructor creates an instance of a tree that uses the specified comparator
for ordering the elements in the tree and allows the caller to specify whether
duplicates are allowed.
|
RandomizedTree(java.util.Collection<? extends E> elements,
java.util.Comparator<? super E> comparator)
This constructor creates an instance of a tree that does not allow duplicate elements
and uses the specified comparator for ordering the elements in the tree.
|
RandomizedTree(java.util.Comparator<? super E> comparator)
This constructor creates an instance of a tree that does not allow duplicate elements
and uses the specified comparator for ordering the elements in the tree.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E newElement) |
void |
clear() |
java.lang.Object |
clone() |
java.util.Comparator<? super E> |
comparator()
This method returns the comparator that is used to order the elements in this collection.
|
boolean |
contains(java.lang.Object element) |
boolean |
equals(java.lang.Object object) |
E |
get(int index)
This method returns the element with the specified index.
|
int |
hashCode() |
int |
indexOf(E element)
This method returns the index of the specified element or -1 if the element
does not exist in the collection.
|
java.util.ListIterator<E> |
iterator() |
java.util.ListIterator<E> |
listIterator()
This method returns an iterator for the collection which is currently pointing
at the slot right before the first element.
|
java.util.ListIterator<E> |
listIterator(int index)
This method returns an iterator for the collection which is currently pointing
at the slot right before the specified index.
|
boolean |
remove(java.lang.Object oldElement) |
int |
size() |
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toStringpublic RandomizedTree()
public RandomizedTree(boolean duplicatesAllowed)
duplicatesAllowed - Whether or not duplicate elements are allowed in the tree.public RandomizedTree(java.util.Comparator<? super E> comparator)
comparator - The comparator to be used to order the elements in the tree.public RandomizedTree(boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
duplicatesAllowed - Whether or not duplicate elements are allowed in the tree.comparator - The comparator to be used to order the elements in the tree.public RandomizedTree(java.util.Collection<? extends E> elements)
elements - The elements that should be used to seed the tree.public RandomizedTree(java.util.Collection<? extends E> elements, boolean duplicatesAllowed)
elements - The elements that should be used to seed the tree.duplicatesAllowed - Whether or not duplicate elements are allowed in the tree.public RandomizedTree(java.util.Collection<? extends E> elements, java.util.Comparator<? super E> comparator)
elements - The elements that should be used to seed the tree.comparator - The comparator to be used to order the elements in the tree.public RandomizedTree(java.util.Collection<? extends E> elements, boolean duplicatesAllowed, java.util.Comparator<? super E> comparator)
elements - The elements that should be used to seed the tree.duplicatesAllowed - Whether or not duplicate elements are allowed in the tree.comparator - The comparator to be used to order the elements in the tree.public int size()
public boolean contains(java.lang.Object element)
public E get(int index)
index - The index of the element to be returned.public int indexOf(E element)
element - The element to be searched for.public boolean add(E newElement)
public boolean remove(java.lang.Object oldElement)
public void clear()
public java.util.ListIterator<E> iterator()
public java.util.ListIterator<E> listIterator()
public java.util.ListIterator<E> listIterator(int index)
index - The index before the next element in the collection to be returned by the iterator.public java.util.Comparator<? super E> comparator()
public boolean equals(java.lang.Object object)
equals in interface java.util.Collection<E>equals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.Collection<E>hashCode in class java.lang.Objectpublic java.lang.Object clone()
clone in class java.lang.ObjectCopyright © 2015 Crater Dog Technologies(TM). All rights reserved.