The getSeat method returns an immutable Seat object for a given ID. Once more, we
return an immutable Seat because we don't want the client to change the object without
using the TheatherBox bean.
Finally, the buyTicket method is the one that actually buys the ticket and, therefore,
sets the ticket as booked. We cannot change the value of an immutable object, but we can
replace it with a new one, which contains another value. The newly created object is
placed in the hashmap instead of the old one.
Search WWH ::