【发布时间】:2017-03-16 18:58:18
【问题描述】:
我有一个像这样的模型“句子”:
String kalimat;
HashMap<String, Double> bobotChiSquare = new HashMap<>();
HashMap<String, Double> bobotTFIDF = new HashMap<>();
HashMap<String, Integer> countTandaBaca = new HashMap<>();
public HashMap<String, Double> getBobotChiSquare() {
return bobotChiSquare;
}
public void setBobotChiSquare(HashMap<String, Double> bobotChiSquare) {
this.bobotChiSquare = bobotChiSquare;
}
我想像这样在对象“句子”上设置值哈希图:
ArrayList <Sentence> listToken = new ArrayList<>();
Sentence sentence = null;
for (int i = 0; i < input.size(); i++) {
sentence.setKalimat(input.get(i));
String[] token = input.get(i).split(" ");
for (int j = 0; j < token.length; j++) {
sentence.setBobotChiSquare(token[j] , new Double(0,0));
}
}
但我在一行中有错误
sentence.setBobotChiSquare(token[j] , new Double(0,0));
谁能帮忙?
【问题讨论】:
标签: java object hashmap setvalue