Buggy code:
public final class RecommenderMapper extends MapReduceBase implements Mapper < LongWritable , VectorWritable , LongWritable , RecommendedItemsWritable > { static final String COOCCURRENCE_PATH = "cooccurrencePath" ; static final String ITEMID_INDEX_PATH = "itemIDIndexPath" ; static final String RECOMMENDATIONS_PER_USER = "recommendationsPerUser" ; static final String USERS_FILE = "usersFile" ; private int recommendationsPerUser ; private MapFilesMap < IntWritable , LongWritable > indexItemIDMap ; private MapFilesMap < IntWritable , VectorWritable > cooccurrenceColumnMap ; private Cache < IntWritable , Vector > cooccurrenceColumnCache ; private FastIDSet usersToRecommendFor ; @ Override public void configure ( JobConf jobConf ) { } @ Override public void map ( LongWritable userID , VectorWritable vectorWritable , OutputCollector < LongWritable , RecommendedItemsWritable > output , Reporter reporter ) throws IOException { if ( ( ( usersToRecommendFor ) != null ) && ( ! ( usersToRecommendFor . contains ( userID . get ( ) ) ) ) ) { return ; } Vector userVector = vectorWritable . get ( ) ; Iterator < Vector . Element > userVectorIterator = userVector . iterateNonZero ( ) ; Vector recommendationVector = new RandomAccessSparseVector ( Integer . MAX_VALUE , 1000 ) ; while ( userVectorIterator . hasNext ( ) ) { Vector . Element element = userVectorIterator . next ( ) ; int index = element . index ( ) ; double value = element . get ( ) ; Vector columnVector ; try { columnVector = cooccurrenceColumnCache . get ( new IntWritable ( index ) ) ; } catch ( TasteException te ) { if ( ( te . getCause ( ) ) instanceof IOException ) { throw ( ( IOException ) ( te . getCause ( ) ) ) ; } else { throw new IOException ( te . getCause ( ) ) ; } } columnVector . times ( value ) . addTo ( recommendationVector ) ; } Queue < RecommendedItem > topItems = new PriorityQueue < RecommendedItem > ( ( ( recommendationsPerUser ) + 1 ) , Collections . reverseOrder ( ) ) ; Iterator < Vector . Element > recommendationVectorIterator = recommendationVector . iterateNonZero ( ) ; LongWritable itemID = new LongWritable ( ) ; while ( recommendationVectorIterator . hasNext ( ) ) { Vector . Element element = recommendationVectorIterator . next ( ) ; int index = element . index ( ) ; <START_BUG> if ( ( userVector . get ( index ) ) != 0.0 ) { <END_BUG> if ( ( topItems . size ( ) ) < ( recommendationsPerUser ) ) { indexItemIDMap . get ( new IntWritable ( index ) , itemID ) ; topItems . add ( new org . apache . mahout . cf . taste . impl . recommender . GenericRecommendedItem ( itemID . get ( ) , ( ( float ) ( element . get ( ) ) ) ) ) ; } else if ( ( element . get ( ) ) > ( topItems . peek ( ) . getValue ( ) ) ) { indexItemIDMap . get ( new IntWritable ( index ) , itemID ) ; topItems . add ( new org . apache . mahout . cf . taste . impl . recommender . GenericRecommendedItem ( itemID . get ( ) , ( ( float ) ( element . get ( ) ) ) ) ) ; topItems . poll ( ) ; } } } List < RecommendedItem > recommendations = new ArrayList < RecommendedItem > ( topItems . size ( ) ) ; recommendations . addAll ( topItems ) ; Collections . sort ( recommendations ) ; output . collect ( userID , new RecommendedItemsWritable ( recommendations ) ) ; } @ Override public void close ( ) { } private static class CooccurrenceCache implements Retriever < IntWritable , Vector > { private final MapFilesMap < IntWritable , VectorWritable > map ; private VectorWritable columnVector ; private CooccurrenceCache ( MapFilesMap < IntWritable , VectorWritable > map ) { } @ Override public Vector get ( IntWritable key ) throws TasteException { } } }

Fix:
if ( ( userVector . get ( index ) ) == 0.0 ) {