Git Product home page Git Product logo

eat-mordern-java's Introduction

Chapter1

Java8 설계의 밑바탕을 이루는 세 가지 개념

스트림 처리

스트림이란 ? 한 번에 한 개씩 만들어지는 연속적인 데이터 항목들의 모임

동작 파라미터화로 메서드에 코드 전달하기

코드 일부를 API로 전달 하기. 동작 파라미터화 (behavior paramterization): 메서드를 다른 메서드로 전달하기

병렬성과 공유 가변 데이터

예전 자바에서는 병렬 처리를 안전하게 하려면 매우 복잡하게 코드를 구현 해야 했다. java8부터는 병렬 처리를 쉽게 할 수 있다.

자바8에 추가된 새로운 개념들

자바 함수

함수라는 용어는 메서드 특히 정적 메서드와 같은 의미로 사용 왜 함수가 필요할까? 프로그래밍 언어의 핵심은 값을 바꾸는것. 역사적인 프로그래밍에서는 일급(first-class)값 이라함. 자바에서도 메서드와 클래스는 이급 시민에 속하였다. 메서드를 일급 시민으로 만들면 좀더 효율적으로 프로그래밍 가능하다.

메서드와 람다를 일급 시민으로

다른 언어에서 메서드를 일급값으로 사용하는 맛을 본다면 자바를 안사용 할수 있으니 자바에서도 가능하게 한것 같음 메서드를 일급 시민으로 다루기 위해서 자바8에 추가된 기능

메서드 참조(method reference):

  • 생성자 메서드 참조 : String::new -> () -> new String()
  • 클래스 메서드 참조 : String::valueOf -> (x) -> String.valueOf(x)
  • 인스턴스 메서드 참조 : String::toString -> (s) -> s.toString()

람다 : 익명 함수

메서드를 일급값으로 취급할 뿐 아니라 람다 (또는 익명함수)를 포함하여 함수도 값으로 취급

스트림

내부 반복 : 스트림 라이브러리 내부에서 모든 데이터가 처리

멀티 스레딩은 어렵다

포크 조인 방식을 지원해서 병렬처리가 쉽다.

디폴트 메소드와 자바 모듈

요즘은 외부에서 만들어진 컴포넌트를 이용해 시스템을 구축하는 경향이 있음

자바에서는 jar파일을 제공하는게 전부였음

자바9에서 모듈 시스템은 모듈을 정의하는 문법을 제공 패키지 모음을 포함하는 모듈을 정의 함으로 jar같은 컴포넌트에 구조를 적용할 수 있음

자바8에서는 디폴트 메소드를 적용해 인터페이스를 쉽게 바꿀수 있도록 디폴트 메소드를 지원

자바8에서는 List에 직접 sort 메서드를 호출할 수 있다.

List 인터페이스에 디폴트 메서드가 추가 되어있기 때문임

default void sort(Comparator <? suer E> c) { Collections.sort(this, c); }

8이전에는 List를 구현하는 모든 클래스가 sort를 구현해야했다. 다이아몬드 상속 문제

자바8에서는 Null을 회피할 수 있는 Optional 제공

eat-mordern-java's People

Contributors

dydrb141 avatar gitbook-bot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.