E
- public interface HGSortedSet<E> extends SortedSet<E>
A variation of the standard SortedSet
interface that offers a
HGRandomAccessResult
of its elements in addition to an
Iterator
. Also, implementations of this interface are guaranteed
to be thread-safe. This guarantee has a little twist: if you call iterator
,
the Iterator
returned is not going to be thread-safe and concurrency issues
may arise if the set is being modified while the iterator is still in use. However,
if you call getSearchResult
(note that HGRandomAccessResult
extends the Iterator
interface), the resulting object will hold
a read lock on the set until its close
is invoked. This means that any
thread trying to modify the set while there's an active search result on it will
block, and this includes the thread that opened the search result.
Modifier and Type | Method and Description |
---|---|
HGRandomAccessResult<E> |
getSearchResult() |
HGRandomAccessResult<E> getSearchResult()
Copyright © 2015. All rights reserved.