Skip to content

Tag: java

Can I extend MapStruct methods?

I’m developing a library and I expect the library to have a mapper like so: Which is meant for internal remapping. Now, I’d like to add a feature where the user can “override” this method, in the sense that they could for example add a statement to ignore the password of the account, w…

Java VMOptions in VSCode

I’m attempting to run a simple JavaFX shown here; } My VMOptions (stored in the default launch.json file) are as follows; However, I keep getting the following I’ve followed countless tutorials and ensured that all the syntax and file locations are correct. Any help is appreciated. Answer Put your…

Checking for overlapping appointments in database not working?

I’m saving appointments to a database and have a method that checks if times are overlapping. I’m calling the method using I don’t receive any errors when saving appointments although they can be for the same exact times. I’m converting a LocalTime to a ZonedDateTime to save in the DB …

division in java programming

The same formula gives different answers to 2296 and 1500, when the expected answer in both cases is 100. Please explain this behavior. I’m quite surprised by this simple thing. Initially I thought this must be due to operator precedence but I cannot understand this. program with 2296 : output: first fo…

How to generate array of unique values

I’m trying to generate an array of unique values but my first number is always 0, how can I fix this? Answer In your approach, you have three mistakes (that I noticed). The first, this loop for (int number = 1; number < list.length; ++number) should start with zero. So, for (int number = 0; number &l…

How to implement an increment method on pairs

I am working on a circular linked list and have implemented the following method to increment the elements of the list by a given value. This method works fine with lists of doubles; however, now I am trying to use it on a list of pairs but I keep getting an error since the method is used for doubles. What

How to create a list of clickable items using Thymeleaf

In my Spring Boot web app, I need to create a list of items using Thymeleaf where clicking and submitting an item sends its value to my controller, which looks like this: Note the controller takes an item parameter. For comparison, this following Thymeleaf dropdown list performs as expected in that when I sel…