T - the type of instances to store.java.lang.Iterable<T>, java.util.Collection<T>, java.util.Set<T>public class TreeSetGreedy<T extends IComparableProperty>
extends java.util.TreeSet<T>
implements java.util.Set<T>
Set that will always successfully add new instances and
guarantee that all the "Comparable properties" of the contained
IComparableProperty
instances will build a set (no duplicates).
Although the interface of Set is preserved and allows
adding any Object only
IComparableProperty instances may
be added to TreeSetGreedy because it uses a proprietary
Comparator.
The added IComparableProperty instances with the lowest
Number property (see
IComparableProperty.getComparableProperty()
) will be returned first from the retrievable Iterator
IComparableProperty (thus meaning the member or accessed
data) is changed from outside, the internal order of this set will get
corrupted and iterations or add/remove calls may fail. Therefore it is
necessary to remove the instance before outside modification and later on add
it again.
| Constructor | Description |
|---|---|
TreeSetGreedy() |
Creates an instance with an internal
Comparator to fulfill the
contract of this class. |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
add(T o) |
Attempts to add the the given
T. |
boolean |
remove(java.lang.Object o) |
containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitpublic TreeSetGreedy()
Comparator to fulfill the
contract of this class.public boolean add(T o)
T.
add in interface java.util.Collection<T extends IComparableProperty>add in interface java.util.Set<T extends IComparableProperty>add in class java.util.TreeSet<T extends IComparableProperty>o - the T to add.TreeSet.add(java.lang.Object)public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<T extends IComparableProperty>remove in interface java.util.Set<T extends IComparableProperty>remove in class java.util.TreeSet<T extends IComparableProperty>TreeSet.remove(java.lang.Object)Copyright © 2001 - 2010 LGPL, All Rights Footloose.