我正在尝试让扫描仪在使用扫描仪时读取文件路径中字符的频率。我应该添加什么来完成此方法以执行我所描述的操作。使用优先级队列。
public static Huffman build(String filePath) throws IOException {
if (filePath == null) {
throw new NullPointerException("File doesn't exist");
} else {
try {
Scanner file = new Scanner(new File(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
while (file.hasNextLine()) {
Scanner s2 = new Scanner(file.nextLine());
while (s2.hasNext()) {
String s = s2.next();
System.out.println(s);
}
}
}
}
回首忆惘然
拉风的咖菲猫
Qyouu
相关分类