sessionConjugationsPerInfinitive method

Map<String, Set<SessionConjugation>> sessionConjugationsPerInfinitive()

Implementation

Map<String, Set<SessionConjugation>> sessionConjugationsPerInfinitive() {
  Map<String, Set<SessionConjugation>> result = HashMap();
  for (PracticeSession session in _sessions) {
    String? key = session.infinitive;
    if (null != key) {
      if (result.keys.contains(key)) {
        result[key]?.add(SessionConjugation(session.mode, session.tense));
      } else {
        Set<SessionConjugation> value = HashSet();
        value.add(SessionConjugation(session.mode, session.tense));
        result.putIfAbsent(key, () => value);
      }
    }
  }
  return result;
}