JAVA/Reference

    LocalDate

    public final class LocalDate extends Object implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable A date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03. LocalDate is an immutable date-time object that represents a date, often viewed as year-month-day. Other date fields, such as day-of-year, day-of-week and week-of-year, can also be accessed. For example, t..

    Optional

    개발을 하면서 다들 NullPointException을 겪어 보셨을 겁니다. 참조 및 예외로 값이 없는 상황에서 가장 구현이 쉬운 'null'을 넣은 탓입니다. (지금은 땅을 치고 후회 중입니다.) 그래서 이러한 상황을 모면하기 위해 개발자들은 'null' 검증을 통해서 코드를 처리하곤 했었습니다. String case1(){ if(ref != null){ null이 아닐 때 처리하는 코드 } return "unknown"// null일 시 리턴 값 } String case2(){ if(ref == null){ return "unknown"// null일 시 리턴 값 } null이 아닐 때 처리하는 코드 } 하지만 참조되는 것이 많을수록 중첩 if문을 사용해야 하고 이는 유지 보수성이 떨어지는 결과를 낳..

    Spliterator 인터페이스

    자바 8은 분할할 수 있는 반복자 'Spliterator'를 제공합니다. Spliterator 인터페이스는 특정 소스의 객체를 탐색하거나 파티셔닝 하기 위한 인터페이스로 Stream의 파이프라이닝 처리를 위한 핵심적인 역할을 하고 있습니다. 특히 'Iterator'와 비슷한 기능을 하지만 'Spliterator'은 특히 병렬 작업에 특화되었습니다! 크게 4가지 메서드를 보고 가겠습니다. 1. boolean tryAdvance(Consumer