Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

구글 Guava 쓰는거 어때요~? #14

@k8nx

Description

@k8nx

기본적으로 Preconditions 이란 기능을 제공하는데 이걸로 assertion 가능하거든요~~ㅋ

예를들면 이런식으로 가능하죠...
Preconditions.checkState(state == State.PLAYABLE, "Can't play movie; state is %s", state);

다음 코드는 not null 체크하고 null 이면 NullPointerException 발생하고 아니면 반환하는 코드입니다.
this.rating = Preconditions.checkNotNull(rating);

static import 하면 조금 더 간결해지죵 ㅋ

훨씬 코드 가독성이 높고 이 이외에도 다양한 Helper 나 유틸리티가 존재합니다.

cloumon 에서 가끔 에러들이 대부분이 상태 체크나 Null 체크에서 걸리는 부분이 조금 있는데 이것이 도움이 될 수도...ㅋ

이 이외에도 Matcher 나 MapMaker 같은 Collections, ToString helper 나 equals helper hash 처리 등 commons 에도 많이 있는 것들을 조금 compact 하게 모아놓은 넘이져 ㅋ

기타 Supplier, Function 등 독특한 개념들을 잘 활용해놨어요.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions