任何想法为什么我无法进入这个HashMap?put
public class UserImpl implements User{
HashMap<String, Double> videoRecords = new HashMap<>();
@Override
public void updateVideoRecord(String currentVideo, double seconds) {
videoRecords.put(currentVideo, seconds);
}
}
IntelliJ的调试器显示两者并传递值,但HashMap不会更新。以下是我用来检测HashMap不接受这些值的内容:currentVideosecondsvideoRecords
@Override
public void updateVideoRecord(String currentVideo, double seconds) {
System.out.println(this.videoRecords);
this.videoRecords.put(currentVideo, seconds);
System.out.println(this.videoRecords);
}
有趣的是,如果我在此方法中初始化HashMap,则值将成功放入其中。
繁星点点滴滴
相关分类