Spring8 [Spring] Request ์ด๋ ธํ ์ด์ (parameter mapping) Request๊ฐ ๋ค์ด์ค๋ ํ์ ์ ๋ฐ๋ผ ๋ฐ๋ ๋ฐฉ์์ด ๋๋๋ค. URI Query String body form @PathVariable @GetMapping( "/api/v1/customers/{customerId}") @ResponseBody public ResponseEntity findCustomer(@PathVariable("customerId") UUID customerId){ var customer = customerService.getCustomer(customerId); return customer.map(v -> ResponseEntity.ok(v)).orElse(ResponseEntity.notFound().build()); } URI ๋ณ์๋ฅผ ํตํด Request๊ฐ ๋ค์ด์ค๋ ํ์ http:/.. 2022. 12. 1. [Java] List ์ ํจ์ฑ ๊ฒ์ฌ ๋ฆฌ๋ทฐ ๋ฐ์๋ค๐คฃ https://jihyehwang09.github.io/2020/04/13/java-list-null-check/ List.size() == 0 ๋ณด๋ค๋ List.isEmpty() ํผ๋๋ฐฑ ๋ฐ์ ๊ฒ๊ณผ ๊ฐ์ด isEmpty๊ฐ ๊ฐ๋ ์ฑ๋ฉด์ ์ง๊ด์ ์ด๋ค. ๋ฟ๋ง ์๋๋ผ, list์ ์ฌ์ด์ฆ๊ฐ 0์ด ์๋๊ฒฝ์ฐ size() ๋ฉ์๋๋ O(n)์ ์๊ฐ๋ณต์ก๋๋ฅผ ๊ฐ์ง๊ธฐ ๋๋ฌธ์ isEmpty() ๋ณด๋ค ๋น์ฉ์ด ๋ง์ด ๋ ๋ค. (isEmpty()๋ O(1)์ ์๊ฐ ๋ณต์ก๋) List null ์ฒดํฌ Java Spring ์ฌ์ฉ์์๋ ์ํ์น ๋ผ์ด๋ธ๋ฌ๋ฆฌ CollectionUtils.isEmpty()๋ฅผ ์ฌ์ฉํ์. import org.springframework.util.CollectionUtils; public class Main { pu.. 2022. 12. 1. ์ด์ 1 2 ๋ค์