Why containsKey did not find the key?

I have the following code: payoffs2exchanges.put(point, exchange); if (!payoffs2exchanges.containsKey(point) ) { game.log.fine("yes"); } else { game.log.fine("no"); } It outputs "no". In other words, I add the key-value pair to the map, and then, immediately after that I check if the key exist and find out that it does not exist. Why? I still have the problem with the key. The following code says every time I add a key I add a new key. And I know that it is not the case. Integer[] point = new Integer[2]; point[0] = proposerBestScore; point[1] = responderBestScore; game.log.fine("In the getCloudOfPayoffs: found payoffs:" + point[0] + "," + point[1] + ". Exchange: " + exchange[0]+","+exchange[1]+","+exchange[2]+","+exchange[3]+","+exchange[4]); // With the following block we ensure that every options (pair of payoffs) is represented by exchange with minimal number of moves. if (!payoffs2exchanges.containsKey(point)) { payoffs2exchanges.put(point, exchange); game.log.fine("In the getCloudOfPayoffs: this option is new. We add it to the map."); } else { game.log.fine("In the getCloudOfPayoffs: this option is old."); Integer[] exchangeFromMap = payoffs2exchanges.get(point); Integer newSum = 0; Integer oldSum = 0; for (int i=0;i

以上就是Why containsKey did not find the key?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准