Space (part 15)

  • 8
  • Locked
We still have to finish the Space class. Implement the getAllItems method: The method should return one common list of all BaseObject objects. Implement the moveAllItems method: The method should move all the objects all at the same time.
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 38 , Greenfield, USA, United States
26 October 2022, 13:04
The average number of attempts being over 3 makes me think that some of you are either forgetting to add the ship to the list, or are making the getAllItems method more complicated than it needs to be. Remember that the Collections class has an addAll method (and List and ArrayList inherit this method).
Level 41 , Amsterdam, Netherlands
27 December 2019, 16:49
Why validation fails in part15: You haven't added Ufo objects to the list?
public List<BaseObject> getAllItems() {
        // You need to create a new list and put all the game objects into it.
//        List<BaseObject> allItems = new ArrayList<>(;
        List<BaseObject> allItems = new ArrayList<>();



        return allItems;

Level 38 , Shanghai, China
16 August 2019, 12:30
It seems that you should change the getters to return List to pass the validation.