All Questions
Tagged with comparative-review java
169
questions
1
vote
3
answers
148
views
Count number of clients that have subscriptions
I have two working solutions, one using an accessor (getSubscription()) and one using a member variable (subscription).
Which ...
4
votes
1
answer
108
views
Spring REST Endpoint for Saving a User Inquiry
Here's a piece of code from codebase I maintain/contribute to.
It is a Spring REST controller, which exposes an endpoint to create user question. The question consists of title, description and ...
1
vote
0
answers
129
views
Making Robert Tarjan's offline LCA algorithm run (much) faster (Java)
I have produced this GitHub repository that compares the performance of:
Robert Tarjan's off-line lowest common ancestors algorithm,
An improvement of the above algorithm.
Typical demo program ...
0
votes
2
answers
434
views
Functional Style if/else in java
I would like to ask the opinion for experts out there. The following code snippet was written by a colleague of mine who is very fond of functional style in Java.
...
1
vote
2
answers
114
views
Circular list vs. doubly-linked list: which is faster?
In this post, I will compare performance of a circular list and a conventional list with head/tail -references:
...
2
votes
1
answer
86
views
Build a message string depending on the type of signature of an invoice
The following method was meant to build a message depending on the type of signature of an invoice. It contains some if-else statements and code duplication.
The original method :
...
1
vote
1
answer
56
views
Comparing a weak fluent API with a strong fluent API in Java [closed]
I have this simple POJO:
...
1
vote
1
answer
97
views
Selection algorithms (order statistic) in Java: linear time vs. sorting selector vs. Quickselect
This post is about computing order statistics: given an array \$A\$ (not necessarily sorted), find the \$k\$th smallest array component. The entire repository is here.
...
1
vote
1
answer
68
views
Shortest path in dags: Part 2/3 - the preprocessing and shortest path algorithms
Part 1/3
Part 3/3
I have this library for performing shortest path queries on dags (directed acyclic graphs). This post presents the shortest path algorithms and the topological sorters. Two ...
1
vote
1
answer
66
views
Comparing two general LCA algorithms in Java
Now I have two algorithms solving a problem: given a general (multi-way) tree, and any array of node names, find the the node that is the deepest common ancestor.
...
3
votes
1
answer
2k
views
Format an integer with space as thousand separator
I need to format a number with space as thousand separator in my Java code for Android.
How can these functions be improved?
What are the pros and cons to the first recursive method?
What are the ...
1
vote
1
answer
212
views
Comparing a prefix tree against a HashSet of strings in Java
Here, I have made an attempt to find out whether a prefix tree is any more efficient than a simple java.util.HashSet<String>. See what I have:
...
1
vote
1
answer
102
views
Java: Using one class or algebraic data types to model different state?
I'm creating a tool to analyze a card game which is played by three players. A Card is associated with a number of points and looks like this:
...
6
votes
5
answers
694
views
Comparing 2 distinct sieve of Eratosthenes algorithms in Java
In this post, I will present and compare two distinct algorithms for sieve of Eratosthenes:
com.github.coderodde.math.prime.PrimeFinder
...
3
votes
3
answers
191
views
Comparing 8 different Disjoint-Set data structure variants in Java
The Wikipedia page on Disjoint-Set data structures presents \$4\$ distinct algorithms for finding the root node of the tree, and \$2\$ distinct algorithms for performing the union operation. In this ...