Example usage for org.apache.mahout.cf.taste.impl.common FastByIDMap isEmpty

List of usage examples for org.apache.mahout.cf.taste.impl.common FastByIDMap isEmpty

Introduction

In this page you can find the example usage for org.apache.mahout.cf.taste.impl.common FastByIDMap isEmpty.

Prototype

public boolean isEmpty() 

Source Link

Usage

From source file:net.ufida.info.mahout.common.MemoryDiffStorage.java

License:Apache License

private void pruneInconsequentialDiffs() {
    // Go back and prune inconsequential diffs. "Inconsequential" means, here, only represented by one
    // data point, so possibly unreliable
    Iterator<Map.Entry<Long, FastByIDMap<RunningAverage>>> it1 = averageDiffs.entrySet().iterator();
    while (it1.hasNext()) {
        FastByIDMap<RunningAverage> map = it1.next().getValue();
        Iterator<Map.Entry<Long, RunningAverage>> it2 = map.entrySet().iterator();
        while (it2.hasNext()) {
            RunningAverage average = it2.next().getValue();
            if (average.getCount() <= 1) {
                it2.remove();//from  w w  w .j  a  v a2 s .c  o m
            }
        }
        if (map.isEmpty()) {
            it1.remove();
        } else {
            map.rehash();
        }
    }
    averageDiffs.rehash();
}