Coder Social home page Coder Social logo

Comments (4)

odrotbohm avatar odrotbohm commented on May 12, 2024

Is that example really something we'd recommend people to do? Turning a List into a Stream i a default method replaces a single method call on the List with an additional method declaration on the repository. Also, it doesn't really create any of the benefits you'd usually get when declaring a Stream method on the repository (actually streaming the results).

from spring-data-examples.

thomasdarimont avatar thomasdarimont commented on May 12, 2024

I just wanted to highlight two different ways to use Java 8 Streams - the variant with the default method simply shows how easy it is to extend the existing API without having to call stream() on the result yourself - this makes for shorter examples and demonstrates another use of default methods.

from spring-data-examples.

odrotbohm avatar odrotbohm commented on May 12, 2024

To me it looks more like a "because you can" rather than something really useful. Would you really add three more lines and an additional repository method instead of just calling ….stream() on the client? Especially if it doesn't really give you a Stream but only a streaming view of the list? Why not declare an additional, really streaming method? You write less code and actually get the benefits of the new return type. IYAM, what we have in #62 is short, concise and practical.

from spring-data-examples.

mp911de avatar mp911de commented on May 12, 2024

Since we have native Stream support, this issue is no longer valid.

from spring-data-examples.

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.