java.lang.Comparable<Key>, Writable, WritableComparable<Key>@LimitedPrivate({"HDFS","MapReduce"})
@Unstable
public class Key
extends java.lang.Object
implements WritableComparable<Key>
The general behavior of a filter| Constructor | Description |
|---|---|
Key() |
default constructor - use with readFields
|
Key(byte[] value) |
Constructor.
|
Key(byte[] value,
double weight) |
Constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo(Key other) |
|
boolean |
equals(java.lang.Object o) |
|
byte[] |
getBytes() |
|
double |
getWeight() |
|
int |
hashCode() |
|
void |
incrementWeight() |
Increments the weight of this key by one.
|
void |
incrementWeight(double weight) |
Increments the weight of this key with a specified value.
|
void |
readFields(java.io.DataInput in) |
Deserialize the fields of this object from
in. |
void |
set(byte[] value,
double weight) |
|
void |
write(java.io.DataOutput out) |
Serialize the fields of this object to
out. |
public Key()
public Key(byte[] value)
Builds a key with a default weight.
value - The byte value of this key.public Key(byte[] value,
double weight)
Builds a key with a specified weight.
value - The value of this key.weight - The weight associated to this key.public void set(byte[] value,
double weight)
value - value.weight - weight.public byte[] getBytes()
public double getWeight()
public void incrementWeight(double weight)
weight - The increment.public void incrementWeight()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void write(java.io.DataOutput out)
throws java.io.IOException
Writableout.public void readFields(java.io.DataInput in)
throws java.io.IOException
Writablein.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields in interface Writablein - DataInput to deseriablize this object from.java.io.IOException - any other problem for readFields.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.