/** * Like {@link #equals(Object)} but doesn't check the URL as strictly, since those can vary * while still representing the same remote repository. * * @param that the {@link BuildData} to compare with. * @return {@code true} if the supplied {@link BuildData} is similar to this {@link BuildData}. * @since TODO */ public boolean similarTo(BuildData that) { if (that == null) { return false; } /* Not similar if exactly one of the two remoteUrls is null */ if ((this.remoteUrls == null) ^ (that.remoteUrls == null)) { return false; } if (this.lastBuild == null ? that.lastBuild != null : !this.lastBuild.equals(that.lastBuild)) { return false; } Set<String> thisUrls = new HashSet<>(this.remoteUrls.size()); for (String url: this.remoteUrls) { thisUrls.add(normalize(url)); } Set<String> thatUrls = new HashSet<>(that.remoteUrls.size()); for (String url: that.remoteUrls) { thatUrls.add(normalize(url)); } return thisUrls.equals(thatUrls); }