Code example for DataOutput

Methods: writeFloat, writeInt

0
        similarity = in.readFloat();
    } 
 
    @Override 
    public void write(DataOutput out) throws IOException {
        out.writeInt(id);
        out.writeFloat(similarity);
    } 
 
    @Override 
    public boolean equals(Object o) {
        if (o == this)
            return true; 
        if (o instanceof HalfPair) {
            HalfPair hp = (HalfPair) o;
            return id == hp.id;
        } 
        return false; 
    } 
 
    @Override