什么是最好的Java原始集合库?(大多数记忆和时间效率)
我发现了Trove和FastUtil是最常用的,但还没有找到他们(或其他人之间)比较多
有比较可用吗?
目前我正在使用扫描仪/文件读取器并使用whilenextline.我认为这种方法效率不高.有没有其他方法来读取具有类似功能的文件?
public void Read(String file) {
Scanner sc = null;
try {
sc = new Scanner(new FileReader(file));
while (sc.hasNextLine()) {
String text = sc.nextLine();
String[] file_Array = text.split(" ", 3);
if (file_Array[0].equalsIgnoreCase("case")) {
//do something
} else if (file_Array[0].equalsIgnoreCase("object")) {
//do something
} else if (file_Array[0].equalsIgnoreCase("classes")) {
//do something
} else if (file_Array[0].equalsIgnoreCase("function")) {
//do something
}
else if (file_Array[0].equalsIgnoreCase("ignore")) {
//do something
}
else if (file_Array[0].equalsIgnoreCase("display")) {
//do something
}
}
} catch (FileNotFoundException e) {
System.out.println("Input file " …Run Code Online (Sandbox Code Playgroud)