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
-
Method Summary
All Methods Instance Methods Concrete Methods 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 Detail
-
TO_COUNT
public static final IntFunction<Counter> TO_COUNT
-
-
Method Detail
-
increment
public void increment()
-
decrement
public void decrement()
-
add
public void add(int value)
-
getCount
public int getCount()
-
reset
public void reset()
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
-