Given the following Java code: import java.util.HashSet;impo…
Given the following Java code: import java.util.HashSet;import java.util.Set;class DataPoint { int id; String label; double value; DataPoint(int id, String label, double value) { this.id = id; this.label = label; this.value = value; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; DataPoint other = (DataPoint) obj; return Double.compare(other.value, this.value) == 0; } @Override public int hashCode() { return label != null ? label.hashCode() : 0; }}public class HashSetTest { public static void main(String[] args) { Set dataSet = new HashSet(); dataSet.add(new DataPoint(101, “A”, 3.14)); dataSet.add(new DataPoint(102, “B”, 2.71)); dataSet.add(new DataPoint(103, “A”, 3.14)); dataSet.add(new DataPoint(104, “B”, 3.14)); dataSet.add(new DataPoint(105, “B”, 2.71)); System.out.println(“Set size: ” + dataSet.size()); }} What would be the printed size of the HashSet?
Read Details