2017-03-16 54 views
0

我有一个模型“句”是这样的:如何设置objeck HashMap中爪哇

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; 
} 

,我想设置值的HashMap的对象“一句”是这样的:

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)); 

任何人都可以帮忙吗?

回答

0

你的方法预计HashMap作为参数,但你通过Stringdouble。你首先必须把它们放入HashMap