public final class Count
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Count |
count(int value)
Count Count static factory creating an instance with the provided value. |
static Count |
none()
A literate shortcut for
count(0) . |
static Count |
once()
A literate shortcut for
count(1) . |
static Count |
thrice()
A literate shortcut for
count(3) . |
java.lang.String |
toString() |
static Count |
twice()
A literate shortcut for
count(2) . |
int |
value()
Obtains an integer value of the current count.
|
public int value()
public static Count count(int value)
Count Count
static factory creating an instance with the provided value.
Additionally checks the value to be equal or more than 0, because count cannot be negative.
value
- a value for a new count instancepublic static Count none()
count(0)
.Count Count
with 0 as a valuepublic static Count once()
count(1)
.Count Count
with 1 as a valuepublic static Count twice()
count(2)
.Count Count
with 2 as a valuepublic static Count thrice()
count(3)
.Count Count
with 3 as a valuepublic java.lang.String toString()
toString
in class java.lang.Object