Package org.eclipse.collections.impl
Class Counter
java.lang.Object
org.eclipse.collections.impl.Counter
- All Implemented Interfaces:
Externalizable
,Serializable
public final class Counter extends Object implements Externalizable
A Counter can be used to increment and return an integer count. A Counter can be used in Anonymous
inner classes if it is declared final, unlike an int, which once declared final cannot be modified.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static IntFunction<Counter>
TO_COUNT
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
add(int value)
void
decrement()
boolean
equals(Object o)
int
getCount()
int
hashCode()
void
increment()
void
readExternal(ObjectInput in)
void
reset()
String
toString()
void
writeExternal(ObjectOutput out)
-
Field Details
-
Constructor Details
-
Method Details
-
increment
public void increment() -
decrement
public void decrement() -
add
public void add(int value) -
getCount
public int getCount() -
reset
public void reset() -
toString
-
equals
-
hashCode
public int hashCode() -
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-