Questions tagged [java]
Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
10,826 questions
4
votes
4
answers
367
views
Finding Special Parts in a Word
Task description:
Imagine you have a long word made up of small letters like "a", "b", "c", ancd so on. Let’s call this word a puzzle word.
We want to look at all the ...
4
votes
1
answer
69
views
Efficient way to win points in chocolate bowl game
I'm working on an optimization problem involving a turn-based chocolate-sharing game, and I need help optimizing my current brute-force solution.
Problem Description:
You and your friend take turns ...
1
vote
0
answers
50
views
repllib.java - a tiny Java library for implementing simple REPL (Read, Evaluate, Print, Loop) programs
I have this GitHub repository - repllib.java. Basically, it's a simple class library for coding REPL functionality with simple format. A typical session may look like this:
...
-2
votes
0
answers
40
views
Priority Queue with Templates in Java with NetBeans [closed]
Does this code works like a priorityQueque? if not, wichc changes should i do to make it work like one, what should i do to improve it, using templates(any type), I have researched a lot about ...
0
votes
0
answers
57
views
Wait for results/failure of an unreliable async operation
Abstract Problem
The basic problem is that of producer/consumer. Wait for an async Producer to [produce an item] or [fail], together with a timeout on the consumer side.
Using Java's ...
4
votes
1
answer
181
views
Implementing Dependency Injection into a JavaFX CRUD Application
As a learning exercise and potential portfolio piece, I decided to create a Java/JavaFX application with MySQL integration.
I used dependency injection because it seemed like the cleanest way to pass ...
5
votes
4
answers
477
views
Count number of substrings in less time
Given an input string contains letters from 'a' to 'g'
Count how many substrings are there in the input string such that
frequency of any character inside the substring is not more than the
number of ...
4
votes
2
answers
110
views
Custom RowSorter that sorts a Swing table containing data with unit suffixes
I would like to hear what you say about my custom RowSorter implementation.
The following comparators should be used for the table columns: String, Double and Integer.
The table data has postfixes and ...
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 ...
6
votes
7
answers
1k
views
Filter non-even elements from an array
I have a method that returns an int[]. The array is made by filtering out only the even values of the array passed into the method.
It works, but it's really ugly ...
0
votes
3
answers
172
views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
5
votes
3
answers
957
views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution?
The code is working, but I want to improve it.
The challenge I am facing is ...
3
votes
1
answer
83
views
Depth-first ListIterator over JTree
I wrote a depth-first ListIterator for JTrees.
Considerations:
It must be a ListIterator, ...
13
votes
5
answers
2k
views
solve n*m matrix processing in less time
I want to solve a problem in less time complexity. Here are the details:
Given an n*m matrix, n rows and m columns. Initially, the matrix is empty filled with 0s.
...
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 ...