๋ชฉ๋ก๋ฉ์๋์ฐธ์กฐ (1)
DevLog ๐ถ

๐ฌ ๋ชจ๋ ์๋ฐ ์ธ ์ก์ ์ฑํฐ 3์ ์ฝ๊ณ ์ ๋ฆฌํ ๊ธ์ ๋๋ค. โ๏ธ ๋ฉ์๋ ์ฐธ์กฐ ๋ฉ์๋ ์ฐธ์กฐ๋ฅผ ์ฌ์ฉํด์ ๋ ์ฝ๋๋ฅผ ๊ฐ๊ฒฐํ๊ฒ ๋ง๋ค์ด๋ณด์. // Before inventory.sort((a1, a2) -> a1.getCourse().compareTo(a2.getCourse())); // After inventory.sort(comparing(Crew::getCourse)); ๋ฉ์๋ ์ด๋ฆ์ ํ์ฉํ๋, '๋ฉ์๋ ์ฐธ์กฐ'๋ฅผ ํ์ฉํ๋ฉด ๋๋ค๋ฅผ ๋ ๊ฐ๊ฒฐํ๊ฒ ํํํ ์ ์๋ค. ๋ฉ์๋ ์ฐธ์กฐ๋ฅผ ํ๊ธฐ ์ํด์๋ ๊ตฌ๋ถ์(::)๋ฅผ ํ์ฉํ๋ค. ๐ฑ ๋ฉ์๋ ์ฐธ์กฐ๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ 1. ์ ์ ๋ฉ์๋ ์ฐธ์กฐ (args) -> ClassName.staticMethod(args) ==> ClassName::staticMethod 2. ๋ค์ํ ํ์์ ์ธ์คํด..
๐/Modern Java in Action
2023. 4. 7. 00:14