Skip to content

260630_22_진미#101

Open
MiJin1996 wants to merge 2 commits into
SurvivalCodingCampus:student/22_진미from
MiJin1996:master
Open

260630_22_진미#101
MiJin1996 wants to merge 2 commits into
SurvivalCodingCampus:student/22_진미from
MiJin1996:master

Conversation

@MiJin1996

Copy link
Copy Markdown

YYMMDD_01_홍길동

📝 과제 정보

  • 교육 주제:

📋 체크리스트

  • 코드 컨벤션 준수 (Formatter 적용)
  • 모든 테스트 케이스 통과 (JUnit)

📷 실행 결과 (또는 테스트 결과)

❓질문 및 어려웠던 점

🔄 자체 평가 & 회고

  • 이번 과제를 통해 새롭게 알게 된 점이나 아쉬운 점을 기록합니다.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

이번 변경에서는 OOP 기본 개념을 연습할 수 있는 예제와 다이어그램이 추가·수정되었습니다.

변경 내용

  • StrongBox를 제네릭 컨테이너에서 열쇠 타입(KeyType)에 따라 잠금 조건이 달라지는 구조로 변경했습니다.
  • StrongBoxTest를 JUnit 테스트 형태로 정리하고, 반환 전에는 null, 조건 충족 후에는 값이 나오는 동작을 검증하도록 바꿨습니다.
  • Book2 클래스를 추가해 title, publishDate, comment캡슐화equals/hashCode/toString 구현을 포함했습니다.
  • TIL 정리 문서를 추가해 List, Set, Map, equals(), 얕은/깊은 복사 등을 복습할 수 있게 했습니다.
  • 여러 PlantUML 파일을 추가/수정해 클래스 관계와 책임을 시각화했습니다.
  • Gradle 설정에서 post-oop 모듈 구성을 반영했습니다.

학습 포인트

  • StrongBox상태(cnt)열쇠 종류에 따라 동작이 달라지므로, “어떤 책임을 클래스가 가져야 하는지”를 생각해보면 좋습니다.
  • Book2equals()hashCode()같은 기준으로 비교되고 있는지 다시 점검해보면 좋습니다.
  • 테스트는 “어떤 시점에 null이어야 하고, 언제 실제 값이 나와야 하는가?”를 기준으로 보면 이해가 쉬워집니다.

Walkthrough

StrongBox의 제네릭 제약을 제거하고 KeyType별 임계값 기반 잠금/해제 get() 로직으로 전면 교체했다. Book2 클래스와 PlantUML 다이어그램이 추가됐고, 게임 유닛 다이어그램, TIL 문서, Gradle 모듈 구조 변경도 포함된다.

Changes

StrongBox KeyType 잠금 로직 구현

Layer / File(s) Summary
StrongBox 구현 및 다이어그램
post-oop/june30th.puml, post-oop/src/main/java/com/survivalcoding/StrongBox.java
K extends KeyType 제네릭 제약 제거, cnt/keyType 필드와 생성자 추가. get()cnt 누적 후 keyType별 임계값(PADLOCK 1024 / BUTTON 10000 / DIAL 30000 / FINGER 1000000) 이상일 때만 data를 반환하고 미만이면 null을 반환하도록 교체. PlantUML 다이어그램에 KeyType enum과 StrongBox<K> 관계 추가.
StrongBox 테스트 및 Gradle 모듈 재구성
post-oop/src/test/java/com/survivalcoding/StrongBoxTest.java, settings.gradle
테스트 엔트리포인트를 main()에서 JUnit test()로 교체. KeyType.PADLOCK으로 생성 후 임계값 미만 구간에서 assertNull, 임계값 도달 후 assertEquals(100, box.get()) 검증. game:post-oop 서브모듈을 최상위 post-oop 모듈로 Gradle 설정 변경.

Book2 클래스 및 게임 다이어그램 추가

Layer / File(s) Summary
Book2 클래스 구현 및 다이어그램
game/june30th.puml, game/src/main/java/com/survivalcoding/Book2.java
title, publishDate, comment 필드와 패키지 프라이빗 생성자, getter/setter, toString() 추가. hashCode()는 세 필드 모두 사용하나 equals()titleData 식별자만 비교하는 불일치가 존재. PlantUML 다이어그램에 Book2 클래스 시그니처 추가.
게임 클래스 다이어그램 및 TIL 문서
game/june22th.puml, game/june23th.puml, TIL/sample/2026-06-30-정리.md
june22th.puml scale을 0.7로 조정. june23th.puml에 게임 유닛 9개 클래스, 인터페이스(cure, unit, Mechanic, Fix, Attack), 추상 클래스(Terran, Zerg, Protoss), 마커 인터페이스 5개 추가. TIL 문서에 자료구조 성능, equals/얕은·깊은 복사 개념, 단축키 목록, 실습 스켈레톤 추가.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning 템플릿 형식은 따르지만 교육 주제, 실행 결과, 질문, 회고가 비어 있어 핵심 정보가 거의 없습니다. 교육 주제와 테스트/실행 결과, 질문 및 회고를 구체적으로 채워 템플릿의 필수 내용을 완성하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 제목이 과제 코드처럼 보이지만 변경 내용을 설명하지 않아 무엇이 바뀌었는지 알기 어렵습니다. 주요 변경을 1문장으로 요약한 제목으로 바꾸세요. 예: 'StrongBox 제네릭/enum 구현 추가'.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (phantom_api, ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
post-oop/src/test/java/com/survivalcoding/StrongBoxTest.java (1)

9-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

PADLOCK만 검증해서 나머지 분기 회귀를 놓치기 쉽습니다.

핵심 변경이 KeyType별 임계값 분기인데, 현재 테스트는 PADLOCK1024회만 확인합니다. BUTTON, DIAL, FINGER도 같은 패턴으로 묶어 검증해야 이번 변경을 제대로 보호할 수 있습니다.

예시 수정
-    `@Test`
-    void test() {
-
-        StrongBox<Integer> box =
-                new StrongBox<>(KeyType.PADLOCK);
-
-        box.put(100);
-
-        for (int i = 0; i < 1023; i++) {
-            assertNull(box.get());
-        }
-
-        assertEquals(100, box.get());
-
-    }
+    `@ParameterizedTest`
+    `@CsvSource`({
+            "PADLOCK,1024",
+            "BUTTON,10000",
+            "DIAL,30000",
+            "FINGER,1000000"
+    })
+    void get_returns_value_only_after_threshold(KeyType keyType, int threshold) {
+        StrongBox<Integer> box = new StrongBox<>(keyType);
+        box.put(100);
+
+        for (int i = 0; i < threshold - 1; i++) {
+            assertNull(box.get());
+        }
+
+        assertEquals(100, box.get());
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@post-oop/src/test/java/com/survivalcoding/StrongBoxTest.java` around lines 9
- 23, The StrongBox test only covers the PADLOCK path, so it can miss
regressions in the other KeyType threshold branches. Update StrongBoxTest to
exercise StrongBox.get() for BUTTON, DIAL, and FINGER as well, using the same
pattern as the existing PADLOCK test but with each type’s expected unlock count.
Keep the assertions grouped by KeyType so the threshold logic in StrongBox and
KeyType is verified across all branches.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@game/june23th.puml`:
- Around line 9-31: The UML names and field identifiers are inconsistent and
contain typos, so clean up the domain terminology across the class declarations
in this diagram. Rename the misspelled class names and attributes in the
PlantUML snippet (for example, align symbols like Trank/Dragun/damege with the
intended game-unit and damage naming) so the diagram uses one stable vocabulary
throughout. Keep the changes localized to the affected class definitions so the
rendered model matches the corrected identifiers everywhere.

In `@game/src/main/java/com/survivalcoding/Book2.java`:
- Around line 49-59: The Book2.equals(Object) implementation is broken and does
not compile; fix it by comparing the actual Book2 fields instead of the invalid
local Data variable and nonexistent bb.Data member. Update equals in Book2 to
use proper null-safe field comparisons (for example via Objects.equals) for
title and the other real member fields, remove the unreachable statement after
return, and keep the logic consistent with hashCode().
- Around line 2-3: Replace the incorrect javax.xml.crypto.Data import in Book2
with a real date type such as java.time.LocalDate, then update the publishDate
field, constructor, getter, and setter in Book2 to use that same type
consistently. Also make sure any related UML mapping in game/june30th.puml is
updated to match the new date type so the model stays aligned with the code.

In `@post-oop/src/main/java/com/survivalcoding/StrongBox.java`:
- Around line 19-20: StrongBox.put(K data)에서 null 저장을 허용하면 get()의 잠김 상태 반환값과 구분이
깨집니다. StrongBox 클래스의 put 메서드에서 null 인자를 명시적으로 거부하도록 수정하고, 잠금/해제 상태를 나타내는 get()의
계약은 유지하세요. put, get, StrongBox 식별자를 기준으로 null 처리 정책을 일관되게 맞추면 됩니다.
- Around line 24-25: The StrongBox constructor currently accepts a null keyType,
which leaves StrongBox.get() unable to match any branch and causes silent,
permanent null returns. Update the StrongBox(KeyType) constructor to validate
keyType immediately and reject null at creation time, using the StrongBox and
get() logic as the reference points to keep the invalid state from being
constructed.

In `@TIL/sample/2026-06-30-정리.md`:
- Around line 5-7: 정리 문구가 equals, compareTo, Set 중복 규칙을 혼동하고 있으니, 해당 메모에서 각 개념을
분리해 수정하세요. compareTo는 정렬/비교 기준 설명으로만 남기고, “같은 내용은 지워진다”는 문장은 Set에서 equals와
hashCode가 함께 일관될 때의 중복 제거로 바꿔 쓰세요. Book2 같은 예제가 있다면 equals/compareTo/HashSet 동작을
각각 구분해서 설명하도록 문구를 정리하세요.

---

Nitpick comments:
In `@post-oop/src/test/java/com/survivalcoding/StrongBoxTest.java`:
- Around line 9-23: The StrongBox test only covers the PADLOCK path, so it can
miss regressions in the other KeyType threshold branches. Update StrongBoxTest
to exercise StrongBox.get() for BUTTON, DIAL, and FINGER as well, using the same
pattern as the existing PADLOCK test but with each type’s expected unlock count.
Keep the assertions grouped by KeyType so the threshold logic in StrongBox and
KeyType is verified across all branches.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 41f4fd5d-19a5-4564-b952-ba23f1a68bfd

📥 Commits

Reviewing files that changed from the base of the PR and between de8f74d and 732343e.

📒 Files selected for processing (10)
  • TIL/sample/2026-06-30-정리.md
  • TIL/sample/📌2026-06-29-정리📌.md
  • game/june22th.puml
  • game/june23th.puml
  • game/june30th.puml
  • game/src/main/java/com/survivalcoding/Book2.java
  • post-oop/june30th.puml
  • post-oop/src/main/java/com/survivalcoding/StrongBox.java
  • post-oop/src/test/java/com/survivalcoding/StrongBoxTest.java
  • settings.gradle
💤 Files with no reviewable changes (1)
  • settings.gradle

Comment thread game/june23th.puml
Comment on lines +9 to +31
class Marine{
-int damege
}
class Trank{
-int damage
}
class Vulture{
-int damage
}
class Scv{
-int damage
}
class Zergling{
-int damage
}
class Hydra{
- int damege
}
class Dragun{
-int damege
}
class Zealot{
- int damege

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

클래스/필드 이름 오타가 다이어그램 의미를 흐립니다.

Trank, Dragun, damege 같은 표기가 여러 군데 섞여 있어 렌더링 결과만 봐도 도메인 용어가 불안정해 보입니다. 학습용 산출물이라도 용어를 한 번 정리해 두는 편이 이후 코드/테스트 이름과 맞추기 쉽습니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@game/june23th.puml` around lines 9 - 31, The UML names and field identifiers
are inconsistent and contain typos, so clean up the domain terminology across
the class declarations in this diagram. Rename the misspelled class names and
attributes in the PlantUML snippet (for example, align symbols like
Trank/Dragun/damege with the intended game-unit and damage naming) so the
diagram uses one stable vocabulary throughout. Keep the changes localized to the
affected class definitions so the rendered model matches the corrected
identifiers everywhere.

Comment on lines +2 to +3
import javax.xml.crypto.Data;
import java.util.Objects;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== Book2.java ==\n'
sed -n '1,220p' game/src/main/java/com/survivalcoding/Book2.java

printf '\n== UML files mentioning Book2 or publishDate ==\n'
rg -n --hidden --glob '!*node_modules*' --glob '!*.class' --glob '!*.jar' 'Book2|publishDate' game/src/main/java game/src/main/resources . || true

Repository: SurvivalCodingCampus/polytech_java2

Length of output: 4149


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== JDK Data type lookup in source and docs hints ==\n'
rg -n 'javax\.xml\.crypto\.Data|publishDate|equals\(' game/src/main/java game/src/main/resources . || true

Repository: SurvivalCodingCampus/polytech_java2

Length of output: 2772


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Book2.java =='
nl -ba game/src/main/java/com/survivalcoding/Book2.java | sed -n '1,220p'

echo
echo '== References to Book2 / publishDate / equals =='
rg -n --hidden --glob '!*node_modules*' 'Book2|publishDate|equals\(' game/src/main/java game/src/main/resources . || true

Repository: SurvivalCodingCampus/polytech_java2

Length of output: 230


publishDate를 날짜 타입으로 바꾸세요.

javax.xml.crypto.Data는 XML 암호화용 인터페이스라 출판일 의미와 맞지 않습니다. 생성자·게터·세터와 game/june30th.puml까지 같은 타입으로 묶여 있으니 java.time.LocalDate 같은 날짜 타입으로 정리하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@game/src/main/java/com/survivalcoding/Book2.java` around lines 2 - 3, Replace
the incorrect javax.xml.crypto.Data import in Book2 with a real date type such
as java.time.LocalDate, then update the publishDate field, constructor, getter,
and setter in Book2 to use that same type consistently. Also make sure any
related UML mapping in game/june30th.puml is updated to match the new date type
so the model stays aligned with the code.

Comment on lines +49 to +59
@Override
public boolean equals(Object obj) {

if (!(obj instanceof Book2)) return false;
Book2 bb = (Book2) obj;
String Data;
return title == bb.title && Data(equals(bb.Data));
title.equals(Data);

//boolean Object;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

equals() 구현은 현재 상태로 컴파일되지 않습니다.

Line 54-56에서 지역 변수 Data 가 타입명을 가리고, bb.Data 는 존재하지 않는 멤버이며, return 뒤의 title.equals(Data); 는 도달 불가 코드입니다. Objects.equals(...) 로 실제 필드들을 비교하도록 정리해야 hashCode() 와의 계약도 맞습니다.

🔧 수정 예시
 `@Override`
 public boolean equals(Object obj) {
-
-    if (!(obj instanceof Book2)) return false;
-    Book2 bb = (Book2) obj;
-    String Data;
-    return title == bb.title && Data(equals(bb.Data));
-    title.equals(Data);
-
-    //boolean Object;
+    if (this == obj) return true;
+    if (!(obj instanceof Book2)) return false;
+    Book2 other = (Book2) obj;
+    return Objects.equals(title, other.title)
+            && Objects.equals(publishDate, other.publishDate)
+            && Objects.equals(comment, other.comment);
 }
🧰 Tools
🪛 PMD (7.25.0)

[Medium] 55-55: UseEqualsToCompareStrings (Error Prone): Use equals() to compare strings instead of '==' or '!='

(UseEqualsToCompareStrings (Error Prone))


[Medium] 56-56: UselessPureMethodCall (Error Prone): Do not call pure method equals if the result is not used.

(UselessPureMethodCall (Error Prone))

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@game/src/main/java/com/survivalcoding/Book2.java` around lines 49 - 59, The
Book2.equals(Object) implementation is broken and does not compile; fix it by
comparing the actual Book2 fields instead of the invalid local Data variable and
nonexistent bb.Data member. Update equals in Book2 to use proper null-safe field
comparisons (for example via Objects.equals) for title and the other real member
fields, remove the unreachable statement after return, and keep the logic
consistent with hashCode().

Source: Linters/SAST tools

Comment on lines +19 to +20
public void put(K date) {
this.data = date;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

null 저장을 허용하면 잠금 상태와 해제 상태를 구분할 수 없습니다.

get()이 잠겨 있을 때 null을 반환하는데, 여기서 put(null)도 허용하면 해제된 뒤에도 동일하게 null이 반환되어 API 의미가 깨집니다. put()에서 null을 거부하거나 반환 계약을 바꿔야 합니다.

예시 수정
+import java.util.Objects;
+
 public void put(K date) {
-    this.data = date;
+    this.data = Objects.requireNonNull(date, "data");
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public void put(K date) {
this.data = date;
import java.util.Objects;
public void put(K date) {
this.data = Objects.requireNonNull(date, "data");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@post-oop/src/main/java/com/survivalcoding/StrongBox.java` around lines 19 -
20, StrongBox.put(K data)에서 null 저장을 허용하면 get()의 잠김 상태 반환값과 구분이 깨집니다. StrongBox
클래스의 put 메서드에서 null 인자를 명시적으로 거부하도록 수정하고, 잠금/해제 상태를 나타내는 get()의 계약은 유지하세요. put,
get, StrongBox 식별자를 기준으로 null 처리 정책을 일관되게 맞추면 됩니다.

Comment on lines +24 to +25
public StrongBox(KeyType keyType) {
this.keyType = keyType;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

keyType는 생성자에서 바로 검증하는 편이 안전합니다.

지금은 new StrongBox<>(null)이 가능해서 get()이 어떤 분기도 타지 못하고 영구적으로 null만 반환합니다. 이 경우는 조용히 실패시키기보다 생성 시점에 막는 편이 낫습니다.

예시 수정
+import java.util.Objects;
+
 public StrongBox(KeyType keyType) {
-    this.keyType = keyType;
+    this.keyType = Objects.requireNonNull(keyType, "keyType");
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public StrongBox(KeyType keyType) {
this.keyType = keyType;
import java.util.Objects;
public StrongBox(KeyType keyType) {
this.keyType = Objects.requireNonNull(keyType, "keyType");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@post-oop/src/main/java/com/survivalcoding/StrongBox.java` around lines 24 -
25, The StrongBox constructor currently accepts a null keyType, which leaves
StrongBox.get() unable to match any branch and causes silent, permanent null
returns. Update the StrongBox(KeyType) constructor to validate keyType
immediately and reject null at creation time, using the StrongBox and get()
logic as the reference points to keep the invalid state from being constructed.

Comment on lines +5 to +7
h1 == h2 는 서로 다른 주소이므로 '=='가 들어갔어도 비교는 equals로 한다
ㄴ> 비교하는 코드 틀 :: [h1.compareTo(h2)]
[equals() 특징] :: equals가 있으면 같은 내용은 지워진다

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

equals, compareTo, Set 중복 규칙 설명이 서로 섞여 있습니다.

compareTo() 는 정렬 기준 비교이고, "같은 내용은 지워진다" 는 Set 에서 equals()hashCode() 가 함께 일관될 때의 동작입니다. 지금 문구대로면 Book2 같은 예제의 동등성 계약을 잘못 학습하기 쉽습니다.

✏️ 문구 예시
-h1 == h2 는 서로 다른 주소이므로 '=='가 들어갔어도 비교는  equals로 한다
-ㄴ> 비교하는 코드 틀 :: [h1.compareTo(h2)]
-[equals() 특징] :: equals가 있으면 같은 내용은 지워진다
+h1 == h2 는 참조 비교이고, 내용 비교는 equals()를 사용한다
+ㄴ> compareTo()는 정렬/대소 비교가 필요할 때 사용한다
+[equals()/hashCode() 특징] :: Set/Map에서 같은 값으로 취급되려면 둘 다 일관되어야 한다
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
h1 == h2 는 서로 다른 주소이므로 '=='가 들어갔어도 비교는 equals로 한다
ㄴ> 비교하는 코드 틀 :: [h1.compareTo(h2)]
[equals() 특징] :: equals가 있으면 같은 내용은 지워진다
h1 == h2 는 참조 비교이고, 내용 비교는 equals()를 사용한다
ㄴ> compareTo()는 정렬/대소 비교가 필요할 때 사용한다
[equals()/hashCode() 특징] :: Set/Map에서 같은 값으로 취급되려면 둘 다 일관되어야 한다
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@TIL/sample/2026-06-30-정리.md` around lines 5 - 7, 정리 문구가 equals, compareTo,
Set 중복 규칙을 혼동하고 있으니, 해당 메모에서 각 개념을 분리해 수정하세요. compareTo는 정렬/비교 기준 설명으로만 남기고, “같은
내용은 지워진다”는 문장은 Set에서 equals와 hashCode가 함께 일관될 때의 중복 제거로 바꿔 쓰세요. Book2 같은 예제가 있다면
equals/compareTo/HashSet 동작을 각각 구분해서 설명하도록 문구를 정리하세요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant