Lesson 1: A bug from a shared mutable list · 8 min
Before you begin · The report · What went wrong
Learners sign in, so every finish and score is recorded. 7 fields to fill in with your details.



Minutes are an estimate.
Before you begin · The report · What went wrong
Terms · Public or private? · Check
Choosing · Redesign · Predict
Which collection? · The modify-while-looping error · Streams in one sentence
Frequent slips · Raise it early · Check
What a framework gives you · Practice
Taken from the course itself.
What is the fix?
Answer: Create a new list inside the loop. A new list per customer means no customer sees another's orders.
Lesson 1: A bug from a shared mutable list
A Car contains an Engine. Which relation is that?
Answer: Has-a, so composition. A car has an engine; it is not a kind of engine.
Lesson 3: Inheritance and interfaces
Removing from a list inside a for-each usually throws...
Answer: A ConcurrentModificationException. Changing the list while a for-each loop is reading it makes the loop's iterator fail.
Lesson 4: Collections and streams
A Bird class has fly() and a penguin subclass must override it with an error.
Best response: Model "can fly" as an interface, only for types that do.
Weaker responses: Leave the error; Add a flag; Copy the code.
Comments from trainers
No comments yet. Tell other trainers how the course went.
Your comment
Comments are public. We remove spam and personal details.