Skip to content

Commit c512e96

Browse files
committed
All countries returned alphabetically
1 parent 19fe16c commit c512e96

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.lambdaschool.countries.demo;
2+
3+
import org.springframework.web.bind.annotation.RequestMapping;
4+
import org.springframework.web.bind.annotation.RestController;
5+
6+
import java.util.ArrayList;
7+
8+
@RestController
9+
@RequestMapping("/names")
10+
11+
public class CountryNameController {
12+
@RequestMapping("/all")
13+
public ArrayList<Country> getCountryDetails() {
14+
CountriesApplication.countryList.countryList.sort((c1, c2)-> c1.getName().compareToIgnoreCase(c2.getName()));
15+
return CountriesApplication.countryList.countryList;
16+
}
17+
}
18+
19+

0 commit comments

Comments
 (0)