@Test public void testCloneObjectsEqual() { BucketStatistics bucketStatistics2 = new BucketStatistics.Builder().withLabel(label) .withActionCounts(actionCountsMap).withActionRates(actionRateMap) .withJointActionCounts(jointActionCounts).withImpressionCounts(impressionCounts) .withJointActionRate(jointActionRate).withBucketComparisons(bucketComparisons).build(); assertThat(bucketStatistics, equalTo(bucketStatistics2.clone())); assertThat(bucketStatistics.clone(), equalTo(bucketStatistics2)); }
@Override public BucketStatistics clone() { BucketStatistics cloned = (BucketStatistics) super.clone(); if (bucketComparisons != null) { Map<Bucket.Label, BucketComparison> clonedComparisons = new HashMap<>(); for (Entry<Label, BucketComparison> entry : bucketComparisons.entrySet()) { clonedComparisons.put(entry.getKey(), entry.getValue().clone()); } cloned.setBucketComparisons(clonedComparisons); } return cloned; }
BucketStatistics extends AbstractContainerStatistics { @Override public BucketStatistics clone() { BucketStatistics cloned = (BucketStatistics) super.clone(); if (bucketComparisons != null) { Map<Bucket.Label, BucketComparison> clonedComparisons = new HashMap<>(); for (Entry<Label, BucketComparison> entry : bucketComparisons.entrySet()) { clonedComparisons.put(entry.getKey(), entry.getValue().clone()); } cloned.setBucketComparisons(clonedComparisons); } return cloned; } }
BucketStatistics extends AbstractContainerStatistics { @Override public BucketStatistics clone() { BucketStatistics cloned = (BucketStatistics) super.clone(); if (bucketComparisons != null) { Map<Bucket.Label, BucketComparison> clonedComparisons = new HashMap<>(); for (Entry<Label, BucketComparison> entry : bucketComparisons.entrySet()) { clonedComparisons.put(entry.getKey(), entry.getValue().clone()); } cloned.setBucketComparisons(clonedComparisons); } return cloned; }  }
BucketStatistics extends AbstractContainerStatistics { @Override public BucketStatistics clone() { BucketStatistics cloned = (BucketStatistics) super.clone(); if (bucketComparisons != null) { Map<Bucket.Label, BucketComparison> clonedComparisons = new HashMap<>(); for (Entry<Label, BucketComparison> entry : bucketComparisons.entrySet()) { clonedComparisons.put(entry.getKey(), entry.getValue().clone()); } cloned.setBucketComparisons(clonedComparisons); } return cloned; }  Bucket.Label getLabel(); void setLabel(Bucket.Label value); Map<Bucket.Label, BucketComparison> getBucketComparisons(); void setBucketComparisons(Map<Bucket.Label, BucketComparison> value); @JsonIgnore void addToBucketComparisons(Bucket.Label bucketLabel, BucketComparison item); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override BucketStatistics clone(); }
BucketStatistics extends AbstractContainerStatistics { @Override public BucketStatistics clone() { BucketStatistics cloned = (BucketStatistics) super.clone(); if (bucketComparisons != null) { Map<Bucket.Label, BucketComparison> clonedComparisons = new HashMap<>(); for (Entry<Label, BucketComparison> entry : bucketComparisons.entrySet()) { clonedComparisons.put(entry.getKey(), entry.getValue().clone()); } cloned.setBucketComparisons(clonedComparisons); } return cloned; }  Bucket.Label getLabel(); void setLabel(Bucket.Label value); Map<Bucket.Label, BucketComparison> getBucketComparisons(); void setBucketComparisons(Map<Bucket.Label, BucketComparison> value); @JsonIgnore void addToBucketComparisons(Bucket.Label bucketLabel, BucketComparison item); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override BucketStatistics clone();  }