Coder Social home page Coder Social logo

ComparatorCompat about lightweight-stream-api HOT 3 CLOSED

annimon avatar annimon commented on June 24, 2024
ComparatorCompat

from lightweight-stream-api.

Comments (3)

aNNiMON avatar aNNiMON commented on June 24, 2024

Hi,

Thanks for raising such an important issue.

  1. In Java 8 Comparators class marked as package private, so I preferred not to use it and chose ComparatorCompat as well as RandomCompat. I understand that Comparators looks much clearer and it is shorter by 5 characters... My bad.

  2. There is chain method:

ComparatorCompat
        .chain(comparator)
        .reversed()
        .thenComparing(...)
        .comparator();

See more examples.

Your approach with an abstract class is much better, I'll think about using it. The only problem is that Comparators implements Comparator is non-obvious. Comparators sounds like an utility class or container, not Comparator instance itself. And I have no idea how to call this class shorter and clearer.

from lightweight-stream-api.

BattleShipPark avatar BattleShipPark commented on June 24, 2024

Hi,
I missed Java 8 Comparators, and agree ComparatorCompat is a good alternative name.

Then, what about ComparatorCompat implements Comparator? I am not sure such an inheritance makes no side effect ever but I think its approach is worth considering.

Thanks.

from lightweight-stream-api.

aNNiMON avatar aNNiMON commented on June 24, 2024

Okay, I managed to make changes without loosing source compatibility.

@BattleShipPark, thank you for that suggestion.

from lightweight-stream-api.

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.