GithubHelp home page GithubHelp logo

Comments (1)

jaejae-yoo avatar jaejae-yoo commented on August 10, 2024
  • 파이프라인이란 여러 개의 스트림이 파이프처럼 연결되어 있는 구조이다.
  • 스트림은 중간 처리와 최종 처리를 파이프라인으로 해결한다.
    즉, 스트림은 중간처리와 최종 처리로 구성되어 있는 구조이다.

중간 처리

  • 중간처리 메서드는 반환 값으로 스트림을 반환한다.
  • 중간 처리 메서드의 예시로는 필터, 매핑 등이 있다.

최종처리

  • 중간 스트림이 생성될 때 요소들이 바로 중간 처리 되는 것은 아니다.
    최종 처리가 시작되기 전까지 지연되다가, 최종 처리가 시작되면 컬렉션의 요소가 하나씩 중간 스트림에서 처리되고 최종 처리까지 오게 된다.

파이프라인 형성 과정 요약

  1. 중간처리 메서드는 중간처리 된 스트림을 리턴한다.
  2. 이 스트림에서 다시 중간처리 메소드를 호출해서 파이프 라인을 형성한다.
  • 최종 스트림이 시작하면 그때서야 컬렉션에서 요소가 하나씩 중간 스트림에서 처리된다.

스트림 파이프라인의 장점
중간 연산은 반환 값으로 스트림을 반환한다. 따라서 여러 중간 연산을 연결해서 질의를 만들 수 있다.
중간 연산을 합치고, 합쳐진 중간 연산을 최종 연산으로 한 번에 처리한다.
중간 연산의 중요한 특징은 단말 연산을 스트림 파이프라인에 실행하기 전까지는 아무 연산도 수행하지 않는다는 것, 즉 lazy라는 것이다.

from 2022-modern-java-in-action.

Related Issues (20)

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.