课程: Learning Java Collections

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: Iterating collections

Challenge: Iterating collections - Java教程

课程: Learning Java Collections

Challenge: Iterating collections

(upbeat music) - [Instructor] Now that we've explored a few ways to iterate collections, let's try a programming challenge. In this challenge, the Landon Hotel has asked you to implement three new methods on the RoomService class. The first method applies a discount to the rate of each room. The rate is provided in decimal form as a double argument to the method. You'll need to use this double to reduce the rate assigned to each room. The next method requires you to return a new collection of rooms that contain rooms from the inventory, which have the same or a higher capacity than the argument provided to the method. The final method is similar. It asks you to return a new collection of rooms that match a particular type and are below a provided rate based on the supplied arguments. This challenge uses the same format as the others. There's a comment in each method describing what needs to be achieved, and…

内容