@Test public void addRandom() throws Exception { SortableSlot slot = new SortableSlot(); slot.begin(100); slot.addRandom(); int same = 0; for (int i = 0; i < 100000; i++) { SortableSlot random = new SortableSlot(); random.begin(100); random.addRandom(); if (slot.equals(random)) { same++; } } assertThat(same, lessThan(100)); }
public void addRandom() throws IOException { buffer.writeInt(random.nextInt()); }
SortableSlot implements WritableComparable<SortableSlot> { public void addRandom() throws IOException { buffer.writeInt(random.nextInt()); } }
SortableSlot implements WritableComparable<SortableSlot> { public void addRandom() throws IOException { buffer.writeInt(random.nextInt()); }  }
SortableSlot implements WritableComparable<SortableSlot> { public void addRandom() throws IOException { buffer.writeInt(random.nextInt()); }  void begin(int slot); int getSlot(); void addByte(int data); void addRandom(); void add(Writable data); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override int compareTo(SortableSlot o); @Override int hashCode(); @Override boolean equals(Object obj); }
SortableSlot implements WritableComparable<SortableSlot> { public void addRandom() throws IOException { buffer.writeInt(random.nextInt()); }  void begin(int slot); int getSlot(); void addByte(int data); void addRandom(); void add(Writable data); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override int compareTo(SortableSlot o); @Override int hashCode(); @Override boolean equals(Object obj); static final String NAME_BEGIN; static final String NAME_ADD_BYTE; static final String NAME_ADD_RANDOM; static final String NAME_ADD; }