@Override public String toString() { return "(" + getFirst() + ", " + getSecond() + ')'; }
@Override public String toString() { return "(" + getFirst() + ", " + getSecond() + ')'; }
@Override public String toString() { return "(" + getFirst() + ", " + getSecond() + ')'; }
IntPairWritable key = record.getFirst(); int topic = key.getFirst(); int word = key.getSecond(); ensureQueueSize(queues, topic); if (word >= 0 && topic >= 0) {
@Test public void testWritable() throws Exception { IntPairWritable one = new IntPairWritable(1,2); IntPairWritable two = new IntPairWritable(3,4); assertEquals(1, one.getFirst()); assertEquals(2, one.getSecond()); assertEquals(3, two.getFirst()); assertEquals(4, two.getSecond()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutput out = new DataOutputStream(bout); two.write(out); byte[] b = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(b); DataInput din = new DataInputStream(bin); one.readFields(din); assertEquals(two.getFirst(), one.getFirst()); assertEquals(two.getSecond(), one.getSecond()); }
@Test public void testGetSet() { IntPairWritable n = new IntPairWritable(); assertEquals(0, n.getFirst()); assertEquals(0, n.getSecond()); n.setFirst(5); n.setSecond(10); assertEquals(5, n.getFirst()); assertEquals(10, n.getSecond()); n = new IntPairWritable(2,4); assertEquals(2, n.getFirst()); assertEquals(4, n.getSecond()); }