Code example for Collection

Methods: contains, size

0
        final Collection<V> inner_roots = roots; 
        Transformer<V, Double> distribution = new Transformer<V, Double>() 
        { 
            public Double transform(V input) 
            { 
                if (inner_roots.contains(input)) 
                    return new Double(1.0 / inner_roots.size()); 
                else 
                    return 0.0; 
            } 
        }; 
         
        return distribution; 
    } 
     
    /** 
     * Returns a Transformer that hub and authority values of 1/<code>roots.size()</code> to each  
     * element of <code>roots</code>. 
     * @param <V> the vertex type 
     * @param roots the vertices to be assigned nonzero scores 
     * @return a Transformer that assigns uniform prior hub/authority probabilities to each root