๐Ÿ’ป ๊ณต๋ถ€ ๊ธฐ๋ก/โ˜• Java

Java | List ๋ชจ๋“  ์š”์†Œ ์ถœ๋ ฅ

  • -

๊ฐœ์š”

List ์ถœ๋ ฅ์„ ํ• ์ค„ ๋ชฐ๋ผ์„œ ๊ฒ€์ƒ‰ํ•ด๋ดค๋‹ค.

 

oh.. awesome

 

๋ฐฉ๋ฒ•

List<Model> list = new ArrayList<>();

list.forEach(System.out::println);
System.out.println(list);//toString() is easy and good enough for debugging.
์ด ์ปฌ๋ ‰์…˜์˜ ์บ๋ฆญํ„ฐ ๋ผ์ธ ํ‘œํ˜„์„ ๋Œ๋ ค์ค๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ํ‘œํ˜„์€ ๋ฐ˜๋ณต์ž์— ์˜ํ•ด ๋ฐ˜ํ™˜๋˜๋Š” ์ˆœ์„œ๋Œ€๋กœ ์ปฌ๋ ‰์…˜์˜ ์š”์†Œ ๋ชฉ๋ก์œผ๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, ๋Œ€๊ด„ํ˜ธ ( “[]”)๋กœ ๋ฌถ์Šต๋‹ˆ๋‹ค. ์ธ์ ‘ํ•œ ์š”์†Œ๋Š” “,”(์‰ผํ‘œ ๋ฐ ๊ณต๋ฐฑ) ๋ฌธ์ž๋กœ ๊ตฌ๋ถ„๋ฉ๋‹ˆ๋‹ค. ์š”์†Œ๋Š” String.valueOf (Object)์— ์˜ํ•ด ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜๋ฉ๋‹ˆ๋‹ค.

 

๊ณ ์ฐฐ

๊ธฐ๋ณธ๊ธฐ๋ฅผ ๊ฐ–์ถ”์ž.

 

 

 

์ถœ์ฒ˜ | ๋ฆฌ๋ทฐ๋‚˜๋ผ

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.