@Test void shouldRefineClusterWithMoreThan128Elements() { final List<Person> firstCluster = IntStream.range(0, 130) .boxed() .map(i -> new Person(i.toString(), "Joanna")) .collect(Collectors.toList()); final Cluster<Long, Person> cluster = new Cluster<>(1L, firstCluster); final RefineClusterImpl<Long, Person> refineCluster = RefineClusterImpl.<Long, Person>builder() .classifier(new CustomClassifier()) .clusterIdGenerator(list -> 0L) .maxSmallClusterSize(120) .build(); final Stream<Cluster<Long, Person>> stream = refineCluster.refine(Stream.of(cluster), Stream.of()); assertThat(stream).hasSize(1); }
public Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters, final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications) { final Map<T, List<ClassifiedCandidate<T>>> relevantClassificationIndex = this.getRelevantClassificationIndex(knownClassifications); return clusters.flatMap(cluster -> this.refineCluster(cluster, this.getRelevantClassifications(cluster, relevantClassificationIndex))); }
RefineClusterImpl implements RefineCluster<C, T> { public Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters, final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications) { final Map<T, List<ClassifiedCandidate<T>>> relevantClassificationIndex = this.getRelevantClassificationIndex(knownClassifications); return clusters.flatMap(cluster -> this.refineCluster(cluster, this.getRelevantClassifications(cluster, relevantClassificationIndex))); } }
RefineClusterImpl implements RefineCluster<C, T> { public Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters, final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications) { final Map<T, List<ClassifiedCandidate<T>>> relevantClassificationIndex = this.getRelevantClassificationIndex(knownClassifications); return clusters.flatMap(cluster -> this.refineCluster(cluster, this.getRelevantClassifications(cluster, relevantClassificationIndex))); }  }
RefineClusterImpl implements RefineCluster<C, T> { public Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters, final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications) { final Map<T, List<ClassifiedCandidate<T>>> relevantClassificationIndex = this.getRelevantClassificationIndex(knownClassifications); return clusters.flatMap(cluster -> this.refineCluster(cluster, this.getRelevantClassifications(cluster, relevantClassificationIndex))); }  Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters,
            final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications); }
RefineClusterImpl implements RefineCluster<C, T> { public Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters, final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications) { final Map<T, List<ClassifiedCandidate<T>>> relevantClassificationIndex = this.getRelevantClassificationIndex(knownClassifications); return clusters.flatMap(cluster -> this.refineCluster(cluster, this.getRelevantClassifications(cluster, relevantClassificationIndex))); }  Stream<Cluster<C, T>> refine(final Stream<? extends Cluster<C, T>> clusters,
            final @NonNull Stream<ClassifiedCandidate<T>> knownClassifications);  }