--- id: java-set title: "Java Set" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["Set interface", "μžλ°” μ…‹"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["java", "programming", "w3schools", "collections-framework", "set"] raw_sources: ["https://www.w3schools.com/java/java_set.asp"] applied_in: [] github_commit: "" --- # [[Java Set]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Order-preservation is NOT a universal Set property β€” plain `Set`/`HashSet` gives no order guarantee at all, and only its specific subtypes (`TreeSet` for sorted order, `LinkedHashSet` for insertion order) add that guarantee back, meaning "use a Set" alone doesn't tell you what iteration order to expect. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`Set` interface** β€” stores unique elements; no duplicates allowed. [S1] - **No guaranteed order by default** β€” unless using `TreeSet` or `LinkedHashSet`. [S1] - **Implementing classes** β€” `HashSet` (fast, unordered), `TreeSet` (sorted), `LinkedHashSet` (insertion order). [S1] - **Common methods** β€” `add()` (no-op if already present), `remove()`, `contains()`, `size()`, `clear()`. [S1] - **Set vs. List** β€” List allows duplicates + maintains order + index access; Set disallows duplicates + no order guarantee + no index access. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Method table: add() (ignored if duplicate), remove(), contains() (existence check), size(), clear(). [S1] - Comparison table: List (duplicates OK, ordered, index access) vs. Set (no duplicates, no order guarantee, no index access). [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 쀑볡을 ν—ˆμš©ν•˜μ§€ μ•Šμ•„μ•Ό ν•˜λŠ” κ°’ μ§‘ν•© μ €μž₯에 Set이 ν‘œμ€€μ μœΌλ‘œ 쓰인닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) ν•΄λ‹Ή μ±•ν„°λŠ” κ°œλ…/λ©”μ„œλ“œν‘œ μ€‘μ‹¬μœΌλ‘œ 별도 μ‹€ν–‰ μ½”λ“œ μ˜ˆμ œκ°€ μ—†μŒ β€” λ‹€μŒ 챕터([[Java HashSet]])μ—μ„œ Set κ΅¬ν˜„μ²΄ μ‹€μŠ΅μ΄ μ‹œμž‘λœλ‹€. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Java Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Java List]], [[Java HashSet]], [[Java TreeSet]], [[Java LinkedHashSet]] - **μ°Έμ‘° λ§₯락:** Set μΈν„°νŽ˜μ΄μŠ€μ˜ 기초 β€” HashSet/TreeSet/LinkedHashSet κ΅¬ν˜„μ²΄ μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Java Set Interface β€” https://www.w3schools.com/java/java_set.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java Set Interface" page (Astra wiki-curation, P-Reinforce v3.1 format).