public class CounterSet extends AbstractSet<Counter<?>>
Counters.
Thread-safe.
| Modifier and Type | Class and Description |
|---|---|
class |
CounterSet.AddCounterMutator
A nested class that supports adding additional counters into the
enclosing CounterSet.
|
| Constructor and Description |
|---|
CounterSet(Counter<?>... counters)
Constructs a CounterSet containing the given Counters.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Counter<?> e) |
boolean |
addCounter(Counter<?> counter)
Adds a counter.
|
void |
addNewCounter(Counter<?> counter)
Adds a new counter, throwing an exception if a counter of the
same name already exists.
|
<T> Counter<T> |
addOrReuseCounter(Counter<T> counter)
Adds the given Counter to this CounterSet.
|
CounterSet.AddCounterMutator |
getAddCounterMutator()
Returns an object that supports adding additional counters into
this CounterSet.
|
Counter<?> |
getExistingCounter(String name)
Returns the Counter with the given name in this CounterSet;
returns null if no such Counter exists.
|
Iterator<Counter<?>> |
iterator() |
int |
size() |
equals, hashCode, removeAlladdAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, clear, contains, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic CounterSet(Counter<?>... counters)
public CounterSet.AddCounterMutator getAddCounterMutator()
public void addNewCounter(Counter<?> counter)
public <T> Counter<T> addOrReuseCounter(Counter<T> counter)
If a counter with the same name already exists, it will be reused, as long as it is compatible.
IllegalArgumentException - if a counter with the same
name but an incompatible kind had already been addedpublic boolean addCounter(Counter<?> counter)
true if the counter was added to the set
and false if the given counter was null or it already existed in
the set.counter - to registerpublic Counter<?> getExistingCounter(String name)
public int size()
size in interface Collection<Counter<?>>size in interface Set<Counter<?>>size in class AbstractCollection<Counter<?>>public boolean add(Counter<?> e)
add in interface Collection<Counter<?>>add in interface Set<Counter<?>>add in class AbstractCollection<Counter<?>>