package com.williamschris;

import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@RestController
public class CustomerController {
    private HashMap<String, Customer> customerMap = new HashMap<>();
    private long customerIdGenerator = 1;

    @RequestMapping(value = "/customer", method = RequestMethod.POST)
    public void addCustomer(@RequestBody Customer c) {
        c.setId(customerIdGenerator);
        customerMap.put(String.valueOf(customerIdGenerator++), c);
    }

    @RequestMapping("/customer/{id}")
    public Customer getCustomer(@PathVariable String id){
        return customerMap.get(id);
    }

    @RequestMapping("/customer")
    public List<Customer> getCustomers(){
        List<Customer> customers = new ArrayList<>();

        for(long i = 1; i < customerIdGenerator; ++i){
            Customer customer = customerMap.get(String.valueOf(i));
            customers.add(customer);
        }

        return customers;
    }

    @RequestMapping(value = "/customer/{id}", method = RequestMethod.DELETE)
    public void deleteCustomer(@PathVariable String id){
        customerMap.remove(id);
    }
}
@@ -775,250 +775,52 @@
     
-List%3CCustomer%3E customers = new ArrayList%3C%3E();%0A%0A        for(long i = 1; i %3C customerIdGenerator; ++i)%7B%0A            Customer customer = customerMap.get(String.valueOf(i));%0A            customers.add(customer);%0A        %7D%0A%0A        return customers
+return new ArrayList%3C%3E(customerMap.values())
 ;%0A  

Fix Map to list problem.