-2
我想用扫描仪读取文件下我似乎有把词语的数组列表一致性树形图的Java
public class Concordance
{
public static void main (String[]args) throws IOException
{
TreeMap <String, ArrayList<Integer>> concordance = new TreeMap <String, ArrayList<Integer>>();
File myfile = new File ("Caesar.txt");
Scanner scan = new Scanner(myfile);
ArrayList <Integer > integer = new ArrayList <Integer>();
for (int i = 0; i < scan.nextLine().length(); i++)
{
String key = scan.nextLine().toLowerCase();
if (scan.nextLine().length(i) > 1)
{
if (concordance.get(key) == null) {
concordance.put(key, 1))
} else {
ArrayList<Integer> value = concordance.get(key).indexOf(integer);
value++;
concordance.put(key, value);
}
}
}
System.out.println(concordance);
}
}
有两个问题,第一个问题的解决方法是这里 http://stackoverflow.com/faq 解决了第一个问题之后,这里有人可能会解决第二个问题......干杯! – Zohaib
'value ++'应该做什么? –