I am new to Java, and I’m trying to figure out how to count Characters in the given string and threat a combination of two characters “eu” as a single character, and still count all other characters as one character. And I want to do that using recursion. Consider the following example. Inpu…
Tag: java
The program cannot do compareTo function after the object’s update information
I am trying to change the position of the product in the print menu after updating some information of the product. Specifically, arrange “Quantity” in descending order. If the products have same quantity, the list will be sorted with the ascending “UnitPrice” field. Initially, if i ad…
Add more element to a 3×3 2D array
I’m writing an inventory list program, that provides the user with option of adding an item to the list of exiting the program. To add an item the user enters 1 and is promoted to enter the item details( item name, price and quantity of the items). The information enter by the user is entered into a 3&#…
Application not compatible with older Android versions
I’m generating an Android application via mvn -Pandroid gluonfx:build gluonfx:package. Here are the versions from the POM: Using graalvm-svm-java17-linux-gluon-22.1.0.1-Final The application works well on Android 8. However, when trying to install it on Android 7.0, a message pops up saying that the app…
Build war files for services when modules are modified
I have a monorepo with the following structure: My end goal here is to deploy the application’s war files to aws via GitHub actions. I am able to deploy individual services whenever there are changes in them, with the command mvn clean install -Dmaven.clean.failOnError=false -f services/foo/pom.xml. How…
Locking execution within CompletableFuture
I need to post-process result of CompletableFuture.supplyAsync execution to get intermediate result. My code looks following In a result I’m facing with java.util.concurrent.CompletionException: java.lang.IllegalMonitorStateException on .thenAccept(resultPerBatch -> { line Seems like I’m using …
Containerizing executables in Java
I have a CEF (Chromium Embedded Framework) application I am controlling with Selenium. Normally the application does not allow multiple instances of it to be running at the same time since it modifies directly its root files. I need to be able to run multiple instances (controlled by Selenium) though and some…
How can I unit-test Exception thrown inside a Lambda?
I have a method: This is how the user authorization test looks like: Is there any way to check the case when a user has entered the wrong password? In the case when I send the wrong password, it doesn’t work because given(this.repository.findByEmail(this.user.getEmail())).willReturn(Optional.of(this.use…
Search in List of X509CRL’s
I have a list of X509 CRL’s. I need to identify some of them somehow. Right now I do it using issuer: But there’s gotta be a better way to do that using knowledge of CRL file format, maybe with comparing public keys or something like that, but I don’t know much about X509CRL’s. Can som…
How to make a parameter override while running a Java jar file?
I have a Java maven project whose Jar file is used as a SDK library in other projects. This SDK is used to call other APIs which are by default in the prod environment. I want to make it run on testing environment by overriding a variable. This is the Routes class which contains the base URL for prod/testing …