我检查了用于字符串压缩的字符串比较方法,并研究了反编译器中的string类,发现基本上有四种方法equalsIgnoreCase()compareToIgnore()
现在我想知道我们使用的两个方法之间的区别,它们是equals()和compareTo(),基本上请说明为什么string类保留了这两个方法。same letters and equal by equals method of Stri
如果我想在自由表单字段中检查一组数量的String(计算机生成的,因此每秒可能有很多),哪种实现方式会更快?private static HashSet<String> values = new HashSet<String>(); ... add 5 Strings to the Set} if (values.contains(enteredValue))}
还是用5个String.equ