Which Map method is useful for frequency counting with a default value?

Practice this question from Quiz: Sorting and String Checks, with options and an explanation.

Question

Which Map method is useful for frequency counting with a default value?

Option A — Correct answer

getOrDefault

getOrDefault avoids a separate containsKey check.

Option B

charAt

Option C

substring

Option D

notify

Quiz: Sorting and String Checks

All questions · Previous question · Next question

Open on QuizMaker