Giter VIP home page Giter VIP logo

simonharmonicminor / java-useful-utils Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 2.0 1.28 MB

Truly immutable collections, functional errors handling, laziness, and measurement utilities

Home Page: https://simonharmonicminor.github.io/Java-Useful-Utils/

License: MIT License

Java 99.98% Shell 0.02%
java laziness measure immutable immutable-collections monads mutable-containers monad functional-programming

java-useful-utils's Issues

Try: replace get() method with orElseThrow()

Try.get method might be confusing because the signature does not tell that it can throw EmptyContainerException. It is better to provide users orElseThrow() variation with zero arguments.

Integrate Checkstyle

Checkstyle is a static analyzer for java. In order to keep the quality on a high level, it should be integrated with the project.

This config and checkstyle version 8.42 should be used.

Define AbstractImmutableCollection class

AbstractImmutableCollection must implement ImmutableCollection interface and any parent collection has to extend this class. AbstractImmutableCollection must declare equals and hashCode methods as abstract

Replace Maven usage with Gradle

The master branch should be deployed to maven central automatically each time a new pull request is merged. The easies way to achieve it is to use com.bmuschko:gradle-nexus-plugin:2.3.1 plugin.

Implement UnmodifiableIterator to return from ImmutableCollection.iterator()

All immutable collections encapsulate java native mutable collections. So, when we type something like

ImmutableArrayList<String> list = ...;
Iterator<String> iterator = list.iterator();

this iterator actually belongs to java.util.ArrayList. So, that means that iterator.remove() may actually delete an element from the list. The solution is to implement UnmodifiableIterator and force immutable collections to return it

Remove Serializable

Those classes should not implement Serializable interface

  • ImmutableHashMap
  • ImmutableArrayList
  • ImmutableHashSet
  • ImmutableTreeMap
  • ImmutableTreeSet
  • PairImpl

Java platform serializability is hard to maintain. More than that, it is not as significant as it used to be.

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.