double (@NotNull UsageCluster cluster, @NotNull SimilarUsage similarUsage) { Ref<Double> cohesionIndex = new Ref<>(0.0); cluster.getUsages() .forEach(usage -> { cohesionIndex.set(cohesionIndex.get() + jaccardDistanceExact(usage.getFeatures(), similarUsage.getFeatures())); }); return cohesionIndex.get() / (cluster.getUsages().size() - 1); }