【发布时间】:2018-01-10 06:49:42
【问题描述】:
我正在尝试解决此错误,但由于某种原因,无法找到修复它的问题。我在这段代码中使用Collection。如果有人能指出我实际上缺少什么,我将是一个很大的帮助。
Collection challenges = null;
Map challengesMap = new HashMap<String,String>();
ForgotPasswordManager forgotPwdMgr = new ForgotPasswordManager(platform);
System.out.println("after ForgotPasswordManager(platform)...before getSecretQuestion()");
challenges = forgotPwdMgr.getSecretQuestion(userID);
System.out.println("after getSecretQuestion()...");
for (Object challenge : challenges) {
String challengeStr = (String)challenge;
System.out.println("doGetChallenges()...ChallengeStr = " + challengeStr);
challengesMap.put(challengeStr.trim(), "");
}
我在网上收到此错误Can only iterate over an array or an instance of java.lang.Iterable:for (Object challenge : challenges)
【问题讨论】:
标签: java object collections