Iterator<ItemPrefWritable> values,
OutputCollector<ItemItemWritable,FloatWritable> output,
Reporter reporter) throws IOException {
List<ItemPrefWritable> prefs = new ArrayList<ItemPrefWritable>();
while (values.hasNext()) {
prefs.add(new ItemPrefWritable(values.next()));
}
Collections.sort(prefs, ByItemIDComparator.getInstance());
int size = prefs.size();
for (int i = 0; i < size; i++) {
ItemPrefWritable first = prefs.get(i);
long itemAID = first.getItemID();
float itemAValue = first.getPrefValue();
for (int j = i + 1; j < size; j++) {
ItemPrefWritable second = prefs.get(j);
long itemBID = second.getItemID();
float itemBValue = second.getPrefValue();
output.collect(new ItemItemWritable(itemAID, itemBID), new FloatWritable(itemBValue - itemAValue));
}
}
}