Category "java"

Validate parameters passed into Constructors during compile time

In a huge project with tens of thousands of Java files there are a couple of Java classes where developers may pass in strings as parameters to a constructor cl

Android 12 Splash Screen API - Increasing SplashScreen Duration

I am learning Android's new SplashScreen API introduced with Android 12. I have so far gotten it to work on my Emulator and Google Pixel 4A, but I want to incre

How to make a vertical side menu, Jmenus in swing?

I'm relatively new to java swing, so I don't know to change the menu component in swing with a vertical one.

Application throwing 500 error when image not found instead of 404

We have shifted from Jboss 6 to Jboss 7.2.9 and we observed one changes in the site. Earlier when we were not find an image then we were getting 404 error which

JavaFX ImageIO.write() doesn't save modified BufferedImage

I'm trying to create an application that lets users modify pictures and then save them. I'm having trouble with the saving part. This is the method that rotates

Random/SplittableRandom error while building quarkus native image with optaplanner

I encounter this "Random/SplittableRandom" error while building my quarkus optaplanner application in a native image: docker run --env LANG=C --rm -v /Users/use

Not able to run Junit test with H2 database SpringBoot

I have a strange problem with my unit test.. My goal is to run test on a H2 database and not on my Mysql database.. Actually the strange thing is that when i cl

Interfaces and static methods in java [closed]

It occurred to me that interfaces cannot be instantiated and hence I could create an interface containing only a bunch of static utilities met

Need help on Arraylist quicksort and partition

Instructions: Given a main() that reads user IDs (until -1), complete the quicksort() and partition() methods to sort the IDs in ascending order using the Quic

ChromeDevTools in selenium, waiting for response bodies

I need to work on ajax response, that is one of responses received upon visiting a page. I use selenium dev tools and java. I create a listener, that intercepts

How to scan a table in DynamoDB with time period?

I have a table in DynamoDB and it has an attribute 'createDate' and I want to do a scan using a filter in a specific period of that attribute (for example: 2022

I was trying to solve "Grid unique path" using Dynamic programming in Java

I am trying to implement a solution for grid unique path using D.P. approach while trying to do so, I don't know why in the middle of execution the value at (0,

Osmdroid loading only Elements inside of a Polygon with OverpassAPIProvider

So I am trying the following: Using the Overpass API in osmdroid to only load those nodes, ways or relations that are within or partially within a Polygon. Twea

How can I sum and average my array in Java

I want to sum and average my array in Java. How can I do that? public class EjerciciosArrays extends javax.swing.JFrame { ArrayList<Double> mi_ar

getResourceAsStream returns null

I'm loading a text file from within a package in a compiled JAR of my Java project. The relevant directory structure is as follows: /src/initialization/Lifepat

Apache POI: default Excel cell styles

Is there are a way to use default Excel cell styles (see below) in Apache POI, similar to default data formats in BuiltinFormats?

Mockito verify still fails on using all Matchers

I am recently writing a JUnit test and I acknowledged that Mockito either needs all Raw values or using all Matchers but I find the following case still fails w

update one or more fields inside of a document, without updating all the fields

I have a feature in my program where I have to enter the user's details such as the user's age, height, and weight. This data will be stored in Firestore. this

?Invalid char constant compile error ?cannot able to declare in java

I am trying declare char constant in java it throwing invalid constant error. public static final char code = 'RETURN';

Getting "Cannot use dynamic template data with a legacy template" with non-legacy template

I'm attempting to integrate with Sendgrid and am having a heck of a time. I have created a dynamic template - a new one, not a legacy one - with a single handl