allAnswers.put(taskId, answers);
}
public boolean isTaskValid(long taskId){
Map<String, List<String>> answers = allAnswers.get(taskId);
TaskItem validTask = findTask(test, taskId);
if (validTask == null) {
System.err.println("task #" + taskId + " not found!");
return false;
}
int answersCount = 0;
// Counting answers
for(Entry<String, List<String>> a : answers.entrySet()){
answersCount += a.getValue().size();
}
List<HashMap<String, String>> validAnswers = validTask.getAnswers();
// Counting valid answers and check answers
int validAnswersCount = 0;
for (HashMap<String, String> validPairs : validAnswers) {
boolean isBad = false;
for(Entry<String, String> entry: validPairs.entrySet()){