Skip to content

[아이템 14] Comparable을 구현할지 고려하라 #13

@punsoo

Description

@punsoo

p.91을 보면

compareTo 메서드에서 관계 연산자 <와 >를 사용하는 이전 방식은 거추장스럽고 오류를 유발하니, 이제는 추천하지 않는다.

라고 되어있습니다.

관계 연산자 <,> 가 어떤 오류를 유발하는 것이며 Integer.compare를 사용하였을 때 어떻게 방지된다는 것일까요?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions