public class LongValue extends Object implements Comparable<LongValue>, Serializable
long
primitive for value classes that want to
implement standard operations on that value without the pain of aggregating a Long
object.Modifier and Type | Field and Description |
---|---|
protected long |
value
the
long value |
Constructor and Description |
---|
LongValue(long value)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(LongValue that)
Compares this
Object to a given Object . |
boolean |
equals(Object that)
Tests for equality.
|
boolean |
greaterThan(long value)
Compares this
LongValue with a primitive long value. |
boolean |
greaterThan(LongValue that)
Compares this
LongValue with another LongValue . |
boolean |
greaterThanOrEqual(long value)
Compares this
LongValue with a primitive long value. |
boolean |
greaterThanOrEqual(LongValue that)
Compares this
LongValue with another LongValue . |
int |
hashCode()
Returns the hash code for this
Object . |
boolean |
lessThan(long that)
Compares this
LongValue with a primitive long value. |
boolean |
lessThan(LongValue that)
Compares this
LongValue with another LongValue . |
boolean |
lessThanOrEqual(long that)
Compares this
LongValue with a primitive long value. |
boolean |
lessThanOrEqual(LongValue that)
Compares this
LongValue with another LongValue . |
static <T extends LongValue> |
max(T lhs,
T rhs)
Returns the max of the two long values.
|
static <T extends LongValue> |
maxNullSafe(T lhs,
T rhs)
Null-safe version of
max(T, T) . |
static <T extends LongValue> |
min(T lhs,
T rhs)
Returns the min of the two long values.
|
String |
toString()
Converts this
LongValue to a String . |
public LongValue(long value)
value
- the long
valuepublic final int compareTo(LongValue that)
Object
to a given Object
.compareTo
in interface Comparable<LongValue>
that
- the Object
to compare withObject
's value, or 1 if greater
than given Object
's valuepublic final boolean equals(Object that)
public final boolean greaterThan(long value)
LongValue
with a primitive long
value.value
- the long
value to compare withtrue
if this LongValue
is greater than the given
long
valuepublic final boolean greaterThanOrEqual(long value)
LongValue
with a primitive long
value.value
- the long
value to compare withtrue
if this LongValue
is greater than or equal to the
given long
valuepublic final boolean greaterThan(LongValue that)
LongValue
with another LongValue
.that
- the LongValue
to compare withtrue
if this LongValue
is greater than the given
LongValue
public final boolean greaterThanOrEqual(LongValue that)
LongValue
with another LongValue
.that
- the LongValue
to compare withtrue
if this LongValue
is greater than or equal to the
given LongValue
public final int hashCode()
Object
.public final boolean lessThan(long that)
LongValue
with a primitive long
value.that
- the long
value to compare withtrue
if this LongValue
is less than the given
long
valuepublic final boolean lessThanOrEqual(long that)
LongValue
with a primitive long
value.that
- the long
value to compare withtrue
if this LongValue
is less than or equal to the given
long
valuepublic final boolean lessThan(LongValue that)
LongValue
with another LongValue
.that
- the LongValue
value to compare withtrue
if this LongValue
is less than the given
LongValue
public final boolean lessThanOrEqual(LongValue that)
LongValue
with another LongValue
.that
- the LongValue
value to compare withtrue
if this LongValue
is less than or equal to the given
LongValue
public String toString()
LongValue
to a String
.public static <T extends LongValue> T min(T lhs, T rhs)
T
- lhs
- rhs
- IllegalArgumentException
- if either argument is null
public static <T extends LongValue> T max(T lhs, T rhs)
T
- lhs
- rhs
- IllegalArgumentException
- if either argument is null
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.