有人知道如何在日志中进行排序吗?我试过使用compareToIgnoreCase
,但我只知道如何将它与字符串一起使用。
public static void main(String[] args)
{
StringLogInterface log;
log = new ArrayStringLog("Example Use");
log.insert("Elvis");
log.insert("King Louis XII");
log.insert("Captain Kirk");
System.out.println(log);
System.out.println("The size of the log is " + log.size());
System.out.println("Elvis is in the log: " + log.contains("Elvis"));
System.out.println("Santa is in the log: " + log.contains("Santa"));
}