Skip to main content
PProfileMatch
← Path

Java · Java Collections: ArrayList and HashMap

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Market stall: sorting the crates

Trick to keep in mind+3 XP

Angle brackets take objects only: int becomes Integer, double becomes Double.

Generics work with reference types, so a primitive cannot go between the angle brackets. Each primitive has a wrapper class, and Java boxes and unboxes automatically when you add or read values. That is why list.add(5) works on a List<Integer> even though 5 is an int.

Read it once, then a question tests whether the trick stuck.