All Questions
Tagged with java design-patterns
302 questions
4
votes
2
answers
520
views
Simple Java program to aggregate lines of a text file
I have just written a small application to aggregate the lines of a text file, for example to group the lines according to the frequency of IP addresses in a log file.
Would the code be sufficiently ...
0
votes
1
answer
61
views
Bulk conditions evaluation throwing a single RuntimeException exception
Bulk conditions evaluation throwing a single exception of a configurable type for all unfulfilled conditions.
It is developed around several design patterns:
(1) fluent interface to configure the ...
1
vote
1
answer
88
views
[Spring Boot][REST] Design Pattern Best Practice (Single Entity, multiple business logic implementations)
I have some problems regarding best-practice design between data source layer(Entity), domain layer(Service) and presentation layer (controller):
I have one entity with a type field in the database to ...
4
votes
1
answer
104
views
Sequentially bidirectional find the indexes of an element into a collection (after second thought)
The util class to find all the indexes on an element into a Collection supports forward and reverse lookup starting from a given index along with changing the ...
3
votes
1
answer
157
views
Mail Client - Displaying email details for selected JTable Row
I'm trying to write a very simple IMAP email client in Java.
There is one table per account with multiple multiline rows.
The last selected row of one of the tables should be displayed in an extra ...
6
votes
3
answers
670
views
Password checker using Decorator Pattern
I'm currently trying a Password checker for password in Decorator Pattern, which will point out what the current password missing to be a strong password (my example will check for 8 characters, at ...
3
votes
1
answer
229
views
A library management system
Following is my code for a library management system. I am pretty new to OOD and trying to learn it. I am specially looking for ways where any design patterns can be useful here. I tried to make ...
2
votes
0
answers
63
views
Implement Iterable where hasNext depends on mutable object state, which is mutated through explicit call
I am trying to implement the Iterable interface on an object, where the hasNext method on iterator will depend on mutable object state. This state is mutated by ...
-1
votes
1
answer
69
views
Object build while sequential read user input [closed]
The implementation reads sequentially the user's input changing the type to build according to user choices.
There are two main components a conditional structural sharing (...
3
votes
1
answer
104
views
Sequentially find the indexes of an element into a collection
Util class to find into a collection the indexes of a given element with multiple occurrences from the first index or relative to a given index.
...
1
vote
2
answers
90
views
Verification job with multiple type of batch verifiers
I have a use case where a verification batch job (non-generic) verifies domains based on its input e.g domain_type, batch_pointer etc. The verification handles it based on the domain type which uses ...
1
vote
1
answer
129
views
Business logic verification template
I have a use case of template design pattern with generics as mentioned below.
I have AbstractVerificationHandler that provides template for verification business ...
0
votes
0
answers
151
views
Chain of Responsibility in the game of Hangman
I tried to do the Hangman Refactoring Kata for the piece of code over here - https://www.youtube.com/watch?v=-0MeoFTj6DU
This is how the initial code looks like after first set of refactorings (i.e. ...
2
votes
1
answer
148
views
Implement saga pattern with Kafka
There are very few example on how to implement saga pattern with Kafka so I tried to come up with my own implementation choreography saga pattern using Kafka. I need to implement outbox pattern as ...
1
vote
1
answer
2k
views
How to transform the CompletableFuture response
Context: I have a client app which consumes an API. I want to call this API is async way (using java.net.http.HttpClient) and once I receive this data then I want ...