Class DynamicSortedTreeSet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
ghidra.generic.util.datastruct.DynamicSortedTreeSet<E>
Type Parameters:
E - the type of the elements
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class DynamicSortedTreeSet<E> extends AbstractSet<E>
A set where the ordering of elements may change over time, based on an alternative comparator

This is an implementation of Set where elements may be sorted by an alternative comparator (usually by "cost"), rather than by the natural ordering. It may seem odd, but the natural ordering is still used to determine the uniqueness of keys. That is, two elements that are unequal -- but are considered equal by the alternative comparator -- may co-exist in the set. (Note: in such cases, the two elements are ordered first-in first-out). Additionally, if the elements are mutable, then their ordering may change over time. This mode of operation is enabled by the update(Object) method, which must be called to notify the set of any change to an element that may affect its order. This set also implements the List and Deque interfaces. Since the set is ordered, it makes sense to treat it as a list. It provides fairly efficient implementations of get(int) and indexOf(Object). Sequential access is best performed via iterator(), since this will use a linked list.

The underlying implementation is backed by TreeValueSortedMap. Currently, it is not thread safe.