I am trying to solve this error, but for some reason, not able to find the issue to fix it. I am using Collection
in this code. If anyone can point me out what actually I am missing, I would be a great help.
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(), "");
}
I am getting this error Can only iterate over an array or an instance of java.lang.Iterable
on line: for (Object challenge : challenges)