New answers tagged java
3
votes
Wait for results/failure of an unreliable async operation
In general, this is what CompletableFuture exists for so in that sense, the solution is just fine. But there are ways to improve it.
The fact that people have ...
1
vote
repllib.java - a tiny Java library for implementing simple REPL (Read, Evaluate, Print, Loop) programs
The architecture of the library is quite restrictive and it could benefit from generics.
First of all, this is a REPL library but it does not provide any helpful tools for the Reading, Printing or the ...
4
votes
Accepted
repllib.java - a tiny Java library for implementing simple REPL (Read, Evaluate, Print, Loop) programs
i have gone through part of the code. my comments below
ReplParser
in addStatement() you inquire if statementList.contains(statement). you have an api method that does exactly that, so you should use ...
2
votes
Finding Special Parts in a Word
In such code, one should look for rules, smart logic.
Here we have sequences x² and xyⁿx. (As already said in an earlier answer, with n = 0 one covers the first sequence.)
The logic here is detecting ...
4
votes
4
votes
Accepted
Finding Special Parts in a Word
The "length 2" rule is unnecessary, just ignore it and read the "length ≥ 3" rule as "length ≥ 2" instead. You can simplify your code accordingly, removing the ...
-3
votes
Finding Special Parts in a Word
To reduce time complexity, we can avoid redundant substring operations and take advantage of string patterns.
This strategy aims to solve the problem efficiently, with a time complexity closer to O(n²)...
3
votes
Accepted
Efficient way to win points in chocolate bowl game
The loop in skipsNeededToWin can take long. It has two phases:
For some time, both you and your friend always take bites.
After that, only you take bites, and your ...
6
votes
Accepted
Implementing Dependency Injection into a JavaFX CRUD Application
Just a few stylistic comments. I'm not familiar with JavaFX so I can't really comment on how you have structured the application.
It is a common practise that package names match some domain name ...
Top 50 recent answers are included
Related Tags
java × 10864algorithm × 1283
performance × 1273
beginner × 1024
object-oriented × 727
android × 659
strings × 637
programming-challenge × 635
array × 500
multithreading × 456
game × 422
swing × 412
interview-questions × 357
design-patterns × 302
tree × 275
sorting × 268
linked-list × 253
recursion × 219
spring × 219
unit-testing × 195
parsing × 179
homework × 174
concurrency × 174
time-limit-exceeded × 172
comparative-review × 168