GithubHelp home page GithubHelp logo

Comments (5)

tonymorris avatar tonymorris commented on May 15, 2024

Why would anyone use standard java collections? What is the use-case for such a thing?

from functionaljava.

MikhailGolubtsov avatar MikhailGolubtsov commented on May 15, 2024

Given a real world project with a modestly big codebase there are tons of usages of standard java collections. It's not easy to turn them all in fj structures in one step. And even if it is possible there are certain APIs with standard collections usage that cannot be changed but should be implemented. So I wish FJ were more friendly in its naming.

from functionaljava.

techtangents avatar techtangents commented on May 15, 2024

Yeah, standard java collections are mutable, therefore impractical. Many
of us come to fj realising this and trying to improve things. So, fj
code will mix with java collections frequently.

I don't use fj in my main project, but have developed a very similar
library. List is the big one. We called it ConsList. I've also used a
prefix of Im for Immutable in other structures.

I fully understand your pain, but I really don't think it's practical to
rename classes in fj. It would break pretty much all fj users.

That leaves a few options:

  1. In your code, try and only use either java.util collections or fj
    collections within the one class.
  2. Qualified imports. Pick which will be qualified (fj or java.util) and
    try to be consistent throughout your project.
  3. Tweak your IDE settings so that fj collections will be imported, but
    java.util ones won't
  4. Push hard to refactor your code to the fj collections.
  5. Fork fj.

If only java had type aliases - you could import a module of aliases and
use those names instead.

from functionaljava.

MikhailGolubtsov avatar MikhailGolubtsov commented on May 15, 2024

@techtangents Thank you for your advice. Refactoring all the things seems too hard for me. Also it would not be nice to bother my team with additional restrictions. I'd rather fork fj.

from functionaljava.

mperry avatar mperry commented on May 15, 2024

Unfortunately the names class with the Java standard library. This puts up artificial barriers to using the library for new users.

Personally, I'd like to rename all the classes that clash (in particular List, Set, Stream, HashMap, HashSet, TreeMap, Writer, Class) but I don't think we should force people using the library to handle the change.

I am supportive of a fork or branch that does this, but fear that it won't be maintained.

from functionaljava.

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.