小记遇见过的代码小片段
[b]符号分隔拼接字符串[/b]
[b]判断相等[/b]
[b]符号分隔拼接字符串[/b]
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
String sep = "";
for (Pair<List<String>,Long> pattern : frequentPatterns) {
sb.append(sep);
sb.append(pattern.toString());
sep = ", ";
}
return sb.toString();
}
[b]判断相等[/b]
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Pattern other = (Pattern) obj;
// expensive check done only if length and support matches
return length == other.length && support == other.support && Arrays.equals(pattern, other.pattern);
}