Dayrvia
Jv

Java · List, Set and Map · Practice questions

Try 3 questions on Java · List, Set and Map, then read the explanations and review the related concepts.

Practice questions

Choose an answer and move to the next question. Grade the last one to see explanations and review links.

3 questions
Q1 What are a.size() and b.size()?
List<String> a = List.of("x", "x", "y");
Set<String> b = new HashSet<>(a);
Q2 What are m.size() and m.get("A")?
Map<String, Integer> m = new HashMap<>();
m.put("A", 2);
m.put("A", 5);
Q3 For custom HashMap keys, what must follow when a.equals(b) is true?
Original practice questions written for Dayrvia.