๐Ÿ‘จ‍๐Ÿ’ป kimtongting
article thumbnail
java Collections / ์ž๋ฐ” ์ปฌ๋ ‰์…˜

์ปฌ๋ ‰์…˜์€ ๋‹ค์ˆ˜์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค๋ฃจ๋Š”๋ฐ ๊ต‰์žฅํžˆ ์„ฌ์„ธํ•˜๊ณ  ๋‹ค์–‘ํ•˜๊ฒŒ ํด๋ž˜์Šค๋“ค๋กœ ๊ตฌํ˜„๋˜์–ด ์ œ๊ณต๋˜๊ณ  ์žˆ๋‹ค. ์ธํ„ฐํŽ˜์ด์Šค์™€ ๋‹คํ˜•์„ฑ์„ ์ด์šฉํ•ด ๊ฐ์ฒด์ง€ํ–ฅ์  ์„ค๊ณ„๋ฅผ ํ†ตํ•œ ํ‘œ์ค€ํ™”๊ฐ€ ์™„์„ฑ๋˜์–ด ์žˆ์–ด, ์šฐ๋ฆฌ ์„ ๋ฐฐ ํ”„๋กœ๊ทธ๋ž˜๋จธ๋“ค์ด ๋จธ๋ฆฌ๋ฅผ ์‹ธ๋งค๊ณ  ๊ณ ์ƒํ•˜์…จ๋˜ ๊ฒƒ๋“ค์„ ํ˜„์žฌ ์šฐ๋ฆฌ๋“ค์€ ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค.. ๋‚˜์ค‘์— ๊ธฐํšŒ๊ฐ€ ๋œ๋‹ค๋ฉด ์ปฌ๋ ‰์…˜ ํ”„๋ ˆ์ž„์›์˜ ์‹ค์ œ์†Œ์Šค๋ฅผ ๋ถ„์„ํ•ด ๋ณด์ž. ๊ฐ์ฒด์ง€ํ–ฅ์ ์ธ ์„ค๊ณ„๋Šฅ๋ ฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๋Š”๋ฐ ํฐ ๋„์›€์ด ๋  ๊ฒƒ์ด๋‹ค. Collectionํ”„๋ ˆ์ž„์›์˜ ํ•ต์‹ฌ ์ธํ„ฐํŽ˜์ด์Šค ์ธํ„ฐํŽ˜์ด์Šค ํŠน์ง• List ์ˆœ์„œ๊ฐ€ ์žˆ๋Š” ๋ฐ์ดํ„ฐ์˜ ์ง‘ํ•ฉ. ๋ฐ์ดํ„ฐ์˜ ์ค‘๋ณต์„ ํ—ˆ์šฉํ•œ๋‹ค. ๊ตฌํ˜„)ArrayList, LinkedList, Stack, Vector etc.. Set ์ˆœ์„œ๋ฅผ ์œ ์ง€ํ•˜์ง€ ์•Š๋Š” ๋ฐ์ดํ„ฐ์˜ ์ง‘ํ•ฉ. ๋ฐ์ดํ„ฐ์˜ ์ค‘๋ณต์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค. ๊ตฌํ˜„)HashSet, TreeSet..

java string to date , date to string

import java.text.SimpleDateFormat; import java.util.Date; //String to Date String str="2020-08-12 17:52:08"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date strToDate=sdf.parse(str);//return : Wed Aug 12 17:52:08 KST 2020 //Date to String SimpleDateFormat f1 = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat f2 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat f3 ..

java string to int , int to string

//String to Int String str = "12345"; int num = Integer.parseInt(str); //Int to String int num2 = 123; String str2 = Integer.toString(num2);