๊ท ํ ์ด์ง ํธ๋ฆฌ ๊ตฌ์กฐ๋ก ๋ฐ์ดํฐ ๊ด๋ฆฌํด์ฃผ๋ ์๋ฃ๊ตฌ์กฐ
์ฝ์ , ์ญ์ , ํ์ : O(logN)
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
TreeMap<Integer, Integer> m = new TreeMap<>();
m.put(5, 6);
m.put(2, 2);
m.put(10, 1);
Iterator<Entry<Intger, Integer>> it = m.entrySet().iterator();
while(it.hasNext()) {
Entry<Integer, Integer> entry = it.next();
System.out.println(entry.getKey() + " " + entry.getValue());
}
}
}
| [์๋ฐ] ์ถ์ ํด๋์ค์ ์ธํฐํ์ด์ค์ ๋ํด ์ค๋ช ํด์ฃผ์ธ์ (0) | 2025.03.27 |
|---|---|
| [JAVA] Random vs SecureRandom vs ThreadLocalRandom (0) | 2024.12.26 |
| [Java] Reflection (0) | 2024.01.06 |
| [Java] Exception, try-catch-finally, try-with-resources (0) | 2023.12.24 |
| [์๋ฐ] ์ดํฉํฐ๋ธ์๋ฐ : 2. ์์ฑ์์ ๋งค๊ฐ๋ณ์๊ฐ ๋ง๋ค๋ฉด ๋น๋๋ฅผ ๊ณ ๋ คํด๋ผ (0) | 2023.10.17 |