hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CloudyEye <suhe...@gmail.com>
Subject Simple SetWritable class
Date Wed, 23 Apr 2008 10:37:43 GMT

I tried to extend TreeSet to be Wrtiable. Here is what I did.

public class SetWritable extends TreeSet<Integer> implements
WritableComparable {

	public void readFields(DataInput in) throws IOException {
		int sz=in.readInt();
		for (int i = 0; i < sz; i++) {

	public void write(DataOutput out) throws IOException {
		Iterator<Integer> iter=this.iterator();
		while (iter.hasNext()) {

 If I remove clear() from the readFields() I am gettting wrong output.(some
old data is written with the new ones !). With "clear()" it is ok as my
simple tests show.

Is this implementaion save to be used ?


View this message in context: http://www.nabble.com/Simple-SetWritable-class-tp16833976p16833976.html
Sent from the Hadoop core-user mailing list archive at Nabble.com.

View raw message