### Question:
SortableSlot implements WritableComparable<SortableSlot> { public void add(Writable data) throws IOException { data.write(buffer); }  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; }### Answer:
@Test public void add() throws Exception { Map<String, SortableSlot> slots = new HashMap<>(); slots.put("0", createWithInt(0)); slots.put("-1", createWithInt(-1)); slots.put("1", createWithInt(1)); slots.put("min", createWithInt(Integer.MIN_VALUE)); slots.put("max", createWithInt(Integer.MAX_VALUE)); slots.put("null", createWithInt(null)); slots.put("0.1", createWithInt(0)); slots.get("0.1").add(new IntOption(1)); List<SortableSlot> copy = new ArrayList<>(slots.values()); Collections.sort(copy); assertThat(copy.get(0), is(slots.get("null"))); assertThat(copy.get(1), is(slots.get("min"))); assertThat(copy.get(2), is(slots.get("-1"))); assertThat(copy.get(3), is(slots.get("0"))); assertThat(copy.get(4), is(slots.get("0.1"))); assertThat(copy.get(5), is(slots.get("1"))); assertThat(copy.get(6), is(slots.get("max"))); }