Class IndexedCollection<K,T extends Comparable>
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.IndexedCollection<K,T>
-
- All Implemented Interfaces:
ReadOnlyIndexedCollection<K,T>
public class IndexedCollection<K,T extends Comparable> extends Object implements ReadOnlyIndexedCollection<K,T>
A collection of sorted objects with fast index by id. By default objects are sorted by their Comparable implementation. Ordering could be changed with custom comparator.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIndexedCollection.CollectionListener<K,T>static classIndexedCollection.CollectionListenerAdapter<K,T>static interfaceIndexedCollection.Processor<T>
-
Field Summary
Fields Modifier and Type Field Description static StringINDEX_CACHE_DELAY_MILLIS_PROPstatic StringINDEX_CACHE_SIZE_THRESHOLD_PROP
-
Constructor Summary
Constructors Constructor Description IndexedCollection()IndexedCollection(Map<K,T> objectsMap)IndexedCollection(Map<K,T> objectsMap, Comparator<? super T> comparator)IndexedCollection(IndexedCollection<K,T> collection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFirstListener(IndexedCollection.CollectionListener<K,T> collectionListener)voidaddListener(IndexedCollection.CollectionListener<K,T> collectionListener)voidafterObjectLoad(T loadedObject)voidclear()booleancontainsKey(K key)Tfind(K id)<C extends Collection<? super T>>
CfindAll(C result, Collection<K> ids)Collection<T>getAll()intgetChangesNumber()Comparator<? super T>getComparator()Set<K>getKeys()Map<K,T>getMap()List<T>getSorted()<C extends List<? super T>>
CgetSorted(C result, Filter<? super T> filter)voidprocessItems(Collection<K> ids, ItemProcessor<T> itemProcessor)voidprocessItems(ItemProcessor<T> itemProcessor)Tput(K id, T obj)Tremove(K id)Treplace(K id, T obj)voidresort()voidsetComparator(Comparator<? super T> comparator)intsize()protected LockwriteLock()
-
-
-
Field Detail
-
INDEX_CACHE_DELAY_MILLIS_PROP
public static final String INDEX_CACHE_DELAY_MILLIS_PROP
- See Also:
- Constant Field Values
-
INDEX_CACHE_SIZE_THRESHOLD_PROP
public static final String INDEX_CACHE_SIZE_THRESHOLD_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IndexedCollection
public IndexedCollection()
-
IndexedCollection
public IndexedCollection(@NotNull IndexedCollection<K,T> collection)
-
IndexedCollection
public IndexedCollection(@NotNull Map<K,T> objectsMap, @NotNull Comparator<? super T> comparator)
-
-
Method Detail
-
setComparator
public void setComparator(@Nullable Comparator<? super T> comparator)
-
getComparator
public Comparator<? super T> getComparator()
-
afterObjectLoad
public void afterObjectLoad(@NotNull T loadedObject)
-
writeLock
@NotNull protected Lock writeLock()
-
find
@Nullable public T find(@NotNull K id)
- Specified by:
findin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
findAll
@NotNull public <C extends Collection<? super T>> C findAll(@NotNull C result, @NotNull Collection<K> ids)
- Specified by:
findAllin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
containsKey
public boolean containsKey(K key)
- Specified by:
containsKeyin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
getSorted
@NotNull public List<T> getSorted()
- Specified by:
getSortedin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
getAll
@NotNull public Collection<T> getAll()
- Specified by:
getAllin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
getSorted
@NotNull public <C extends List<? super T>> C getSorted(@NotNull C result, @NotNull Filter<? super T> filter)
- Specified by:
getSortedin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
getKeys
@NotNull public Set<K> getKeys()
- Specified by:
getKeysin interfaceReadOnlyIndexedCollection<K,T extends Comparable>- Returns:
- key set copy
- Since:
- 7.0
-
size
public int size()
- Specified by:
sizein interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
addListener
public void addListener(@NotNull IndexedCollection.CollectionListener<K,T> collectionListener)
-
addFirstListener
public void addFirstListener(@NotNull IndexedCollection.CollectionListener<K,T> collectionListener)
-
clear
public void clear()
-
resort
public void resort()
-
getChangesNumber
public int getChangesNumber()
- Specified by:
getChangesNumberin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
processItems
public void processItems(@NotNull Collection<K> ids, @NotNull ItemProcessor<T> itemProcessor)- Specified by:
processItemsin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
processItems
public void processItems(@NotNull ItemProcessor<T> itemProcessor)- Specified by:
processItemsin interfaceReadOnlyIndexedCollection<K,T extends Comparable>
-
-