Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 11 support: Utilize new methods #987

Closed
iluwatar opened this issue Oct 12, 2019 · 25 comments
Closed

Java 11 support: Utilize new methods #987

iluwatar opened this issue Oct 12, 2019 · 25 comments

Comments

@iluwatar
Copy link
Owner

iluwatar commented Oct 12, 2019

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

This is a refactoring ticket where we start to utilize new Java 11 functionality.

  1. Collecting to unmodifiable collections is possible using the new Collector for Streams operations to put the results into an immutable collection (see https://www.infoq.com/articles/upgrading-java-8-to-12/)

  2. Predicate::not provides an easy way to negate predicate lambdas or method references, again reducing the boilerplate in our code (see https://www.infoq.com/articles/upgrading-java-8-to-12/)

  3. New methods on Optional give even more options for coding in a functional style when using an Optional instead of having to use clumsy if statements (see https://winterbe.com/posts/2018/09/24/java-11-tutorial/)

  4. Streams have new methods ofNullable, dropWhile, takeWhile (see https://winterbe.com/posts/2018/09/24/java-11-tutorial/)

  5. String has new helper methods (see https://winterbe.com/posts/2018/09/24/java-11-tutorial/)

  6. InputStream finally gets a super useful method to transfer data to an OutputStream (see https://winterbe.com/posts/2018/09/24/java-11-tutorial/)

  7. Convenience Factory Methods for Collections make it significantly easier to create collections like lists, maps and sets (see https://winterbe.com/posts/2018/09/24/java-11-tutorial/)

It's a huge task to do this for all the patterns at once so it is possible to create pull requests for individual patterns. This way we can complete the task gradually. The following checklist tracks which patterns have already been refactored.

[x] abstract-document
[x] abstract-factory
[x] acyclic-visitor
[x] adapter
[x] aggregator-microservices
[x] ambassador
[x] api-gateway
[x] async-method-invocation
[x] balking
[x] bridge
[x] builder
[x] business-delegate
[x] bytecode
[x] caching
[x] callback
[x] chain
[x] circuit-breaker
[x] collection-pipeline
[x] command
[x] commander
[x] composite
[x] converter
[x] cqrs
[x] dao
[x] data-bus
[x] data-locality
[x] data-mapper
[x] data-transfer-object
[x] decorator
[x] delegation
[x] dependency-injection
[x] dirty-flag
[x] double-checked-locking
[x] double-dispatch
[x] eip-aggregator
[x] eip-message-channel
[x] eip-publish-subscribe
[x] eip-splitter
[x] eip-wire-tap
[x] event-aggregator
[x] event-asynchronous
[x] event-driven-architecture
[x] event-queue
[x] event-sourcing
[x] execute-around
[x] extension-objects
[x] facade
[x] factory-kit
[x] factory-method
[x] faq.md
[x] feature-toggle
[x] fluentinterface
[x] flux
[x] flyweight
[x] front-controller
[x] guarded-suspension
[x] half-sync-half-async
[x] hexagonal
[x] intercepting-filter
[x] interpreter
[x] iterator
[x] layers
[x] lazy-loading
[x] leader-election
[x] marker
[x] master-worker-pattern
[x] mediator
[x] memento
[x] model-view-controller
[x] model-view-presenter
[x] module
[x] monad
[x] monostate
[x] multiton
[x] mute-idiom
[x] mutex
[x] naked-objects
[x] null-object
[x] object-mother
[x] object-pool
[x] observer
[x] page-object
[x] partial-response
[x] pipeline
[x] poison-pill
[x] priority-queue
[x] private-class-data
[x] producer-consumer
[x] promise
[x] property
[x] prototype
[x] proxy
[x] queue-load-leveling
[x] reactor
[x] reader-writer-lock
[x] repository
[x] resource-acquisition-is-initialization
[x] retry
[x] semaphore
[x] servant
[x] serverless
[x] service-layer
[x] service-locator
[x] singleton
[x] spatial-partition
[x] specification
[x] state
[x] step-builder
[x] strategy
[x] template-method
[x] thread-pool
[x] throttling
[x] tls
[x] tolerant-reader
[x] trampoline
[x] twin
[x] typeobjectpattern
[x] unit-of-work
[x] value-object
[x] visitor

@leonmak
Copy link
Contributor

leonmak commented Oct 13, 2019

HI I would like to work on this, noticed it was combined from a few tickets, do I make a PR for each point?

@iluwatar
Copy link
Owner Author

Let's use the same gradual approach as we are doing in #984. You can do the refactoring for a single pattern or many. We'll then track the progress with a checklist.

@leonmak ok, you're good to go

@Anurag870
Copy link
Contributor

@iluwatar I will work on the following patterns:
unit-of-work
value-object
visitor

@iluwatar
Copy link
Owner Author

Ok @Anurag870

Anurag870 added a commit to Anurag870/java-design-patterns that referenced this issue Oct 26, 2019
iluwatar pushed a commit that referenced this issue Oct 26, 2019
* #984 for unitofwork, tolerantreader, twin

* #984 for unitofwork, tolerantreader, twin

* #987 for visitor, value-object, unitofwork, typeobjectpattern, tolerantreader, twin, tranpoline
@leonmak
Copy link
Contributor

leonmak commented Oct 27, 2019

I would like to work on:

  • abstract-document
  • collection-pipeline
  • commander
  • composite
  • converter

@leonmak
Copy link
Contributor

leonmak commented Oct 27, 2019

Also would like to work on:

  • dao
  • double-dispatch
  • facade
  • flyweight

@Anurag870
Copy link
Contributor

Also checked in code after checking

typeobjectpattern, tolerantreader, twin, trampoline

@iluwatar
Copy link
Owner Author

Ok @leonmak
@Anurag870 do you mean that code for those patterns has already been refactored?

@leonmak
Copy link
Contributor

leonmak commented Oct 28, 2019

cool, thanks.
some more which I've worked on:

  • hexagonal
  • iterator
  • layers
  • leader-election
  • observer
  • page-object
  • partial-response
  • sample-application
  • servant
  • service-layer
  • thread-pool

iluwatar pushed a commit that referenced this issue Oct 29, 2019
* Use java 11

* Use .of
- Replace Arrays.asList with List.of
- Replace HashSet<>(List.of()) with Set.of

* Formatting
@anuragagarwal561994
Copy link
Contributor

@iluwatar picked up ambassador async-method-invocation balking bridge builder in #1076

@iluwatar iluwatar mentioned this issue Nov 10, 2019
@anuragagarwal561994
Copy link
Contributor

@iluwatar picked up remaining b-c in #1081

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked up starting with a in #1084

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked up from t-v in #1085

iluwatar added a commit that referenced this issue Nov 12, 2019
@anuragagarwal561994
Copy link
Contributor

@iluwatar picked all c-e in #1111 and #1112

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked all f in #1115

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked remaining g,h,i in #1116

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked all s in #1120

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked q-r in #1121

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked all p in #1122

iluwatar pushed a commit that referenced this issue Mar 22, 2020
* Java 11 support: lazy-loading pattern

* Java 11 support: layers pattern

* Java 11 support: leader-election/lazy-loading patterns
@anuragagarwal561994
Copy link
Contributor

@iluwatar picked all m in #1220

@vINCENT8888801
Copy link
Contributor

Hi, I am new to this project. May I work on [ ] null-object?

@anuragagarwal561994
Copy link
Contributor

@iluwatar picked remaining patterns in #1479

@iluwatar
Copy link
Owner Author

iluwatar commented Aug 8, 2020

Ok @anuragagarwal561994

@anuragagarwal561994
Copy link
Contributor

@iluwatar finally is it time that we close this :D

@iluwatar iluwatar added this to the 1.23.0 milestone Aug 8, 2020
@iluwatar
Copy link
Owner Author

iluwatar commented Aug 8, 2020

@anuragagarwal561994 I really think so 😄 I'm grateful for your persistent effort on this 👍🏻

@iluwatar iluwatar closed this as completed Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants