/** * Checks two pairs for equality. * * @param obj object for comparison * @return <code>true</code> if <code>obj</code> is equal to this object, <code>false</code> * otherwise */ public boolean equals(Object obj) { PairOfIntString pair = (PairOfIntString) obj; return leftElement == pair.getLeftElement() && rightElement.equals(pair.getRightElement()); }
/** * Defines a natural sort order for pairs. Pairs are sorted first by the left element, and then by * the right element. * * @return a value less than zero, a value greater than zero, or zero if this pair should be * sorted before, sorted after, or is equal to <code>obj</code>. */ public int compareTo(PairOfIntString pair) { int pl = pair.getLeftElement(); String pr = pair.getRightElement(); if (leftElement == pl) { return rightElement.compareTo(pr); } return leftElement < pl ? -1 : 1; }
public void map(IntWritable key, PairOfIntString t, OutputCollector<IntWritable, Text> output, Reporter reporter) throws IOException { KEY.set(t.getLeftElement()); VALUE.set(t.getRightElement()); output.collect(KEY, VALUE); } }
arrayList.add(new AnchorText(AnchorTextConstants.Type.OTHER_TYPES.val, key.getRightElement())); int currentIndex = arrayList.size() - 1; arrayList.get(currentIndex).addDocument(packet); } else { arrayList.add(new AnchorText(AnchorTextConstants.Type.OTHER_TYPES.val, key.getRightElement(), packet)); currentIndex = arrayList.size() - 1;