Java SE 8
2014. 3. 14. Released.
Summary
- JEP 174: Project Nashorn, a JavaScript runtime which can run JavaScript code embedded within applications
- JEP 104: 자바 타입에 대한 어노테이션
- 부호 없는 정수 연산
- JEP 120: 반복적인 어노테이션
- JEP 150: Date and time API
- JEP 178: 정적으로 연결된 JNI 라이브러리
- JEP 153: Launch JavaFX applications (direct launching of JavaFX application JARs)
- JEP 122: Remove the permanent generation
Description
- Lambda Expression 람다표현식: 함수형 연산자 functional-style operation (화살표 연산자)
() -> { ... }
- 타언어에 대응되는 delegate 없음. (java의 delegate는 interface를 통한 메서드 실행을 의미. Strategy Pattern. 전략패턴)
interfacedefault키워드 사용시 인터페이스에서도 메서드 구현 가능interfacestaticmethod: `static` 키워드 사용시 인터페이스에서도 메서드 구현 가능- double colon operator
::: 메서드/속성 자돈 추론 대입(?)
Arrays.asList(c1, c2, c3).forEach(System.out::print); // 메서드 호출 InterfaceComputer c = Computer::new; // 생성자 호출
Optional<T>- API
Nashorn(JavaScript Engine)- new Date and Time API
- Stream API( filter, map, sorted) 등을 지원
- Collection에 대한 함수형화 (Interface에 default로 인해 가능)
- 새로운 날짜와 시간 API인 java.time 패키지를 제공
- 32비트 지원 마지막 공식버전
- target typing 목표 타이핑: 컴파일러가 올바른 타입을 추론하지 못함을 해결