I am learning Java, and found a code segment as follows.
public static void displayClusters(final Collection<Cluster> clusters)
{
displayClusters(clusters, Integer.MAX_VALUE);
}
public static void displayClusters(final Collection<Cluster> clusters,
int maxNumberOfDocumentsToShow)
{
displayClusters(clusters, maxNumberOfDocumentsToShow,
ClusterDetailsFormatter.INSTANCE);
}
public static void displayClusters(final Collection<Cluster> clusters,
int maxNumberOfDocumentsToShow, ClusterDetailsFormatter clusterDetailsFormatter)
{
System.out.println("\n\nCreated " + clusters.size() + " clusters\n");
int clusterNumber = 1;
for (final Cluster cluster : clusters)
{
displayCluster(0, "" + clusterNumber++, cluster, maxNumberOfDocumentsToShow,
clusterDetailsFormatter);
}
}
It seems to me that there are three different implementations for displayClusters with different argument settings.
I am interested in knowing the point of this kind of design. And how the process is going when we have the following invocation in terms of the above three different implementations.
// Show clusters
if (clusters != null)
{
displayClusters(clusters);
}