FirstType
- Type of the first object in the pair.SecondType
- Type of the second object in the pair.public class DefaultWeightedPair<FirstType,SecondType> extends DefaultPair<FirstType,SecondType> implements WeightedPair<FirstType,SecondType>
DefaultWeightedPair
class extends the DefaultPair
class
to add a weight to the pair.Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_WEIGHT
The default weight for the pair is 0.0.
|
protected double |
weight
The weight for the pair.
|
first, second
Constructor and Description |
---|
DefaultWeightedPair()
Creates a new instance of
DefaultWeightedPair . |
DefaultWeightedPair(FirstType first,
SecondType second,
double weight)
Creates a new instance of
DefaultWeightedPair . |
Modifier and Type | Method and Description |
---|---|
double |
getWeight()
Sets the weight of the pair.
|
void |
setWeight(double weight)
Gets the weight of the pair.
|
clone, create, create, equals, equals, getFirst, getSecond, hashCode, mergeCollections, setFirst, setSecond
public static final double DEFAULT_WEIGHT
protected double weight
public DefaultWeightedPair()
DefaultWeightedPair
.public DefaultWeightedPair(FirstType first, SecondType second, double weight)
DefaultWeightedPair
.first
- The first object in the pair.second
- The second object in the pair.weight
- The weight for the pair.