“`java
List lines = new ArrayList<>();
Map byItem = new TreeMap<>();
for (Line l : lines) byItem.merge(l.item(), l.amount(), Double::sum); // like SUMIF
double taxable = lines.stream().mapToDouble(Line::amount).sum();
“`
List keeps order and allows duplicates; Map stores key-value pairs (TreeMap sorted by key, HashMap fastest). Streams express filter/map/sum in one line.
Code for this course follows standard, current syntax; we test JavaScript and PowerShell scripts before publishing, and R/Java/Rust examples are kept to core language features. Tell us if anything fails on your setup.