Category "java"

Java PriorityQueue no way to initialize with a Collection and custom comparator?

I read through the implementation of Java PriorityQueue, the constructors it has are: PriorityQueue() PriorityQueue(Collection<? extends E> c) Priority

pitest report can't mix JUnit 4 and JUnit 5 tests

Recently, I introduced Pitest as the mutation testing tool to our team to diagnose test quality, and we loved it. In our codebase, we have lots of preexisting J

java.lang.ClassNotFoundException: com.fasterxml.jackson.annotation.JsonInclude$Value

I am trying to convert my json string to java object and I am getting error Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/ann

Allowed packages in custom header of Kafka-Message

In spring-kafka, how do I add classes from a package to be trusted as a custom header field? The message is being sent like this: @Autowired private KafkaTemp

Styling and organizing nodes inside a scene

I want to do the following things: Organize my JavaFX code's nodes Increase the size of my combo boxes a little bit Change the scene background's color. My c

How do I generate a JaCoCo report for a JAR file?

We are trying to report code coverage of tests against a pre-packaged JAR file using JaCoCo. To do this we start the JAR file using java -jar with the additiona

How to sleep a thread in java for few milliseconds?

I would like to sleep a thread for 1ms. I used to implement the sleep in java code with Thread.sleep(x) being x the amout of milliseconds that I want to sleep.

Convert Int in Request Body to Long always

I wrote my backend in Java, and the endpoint is hit with a request body. The endpoint has a JSON body that looks like this {"id": 1234, "data": {...}} Now, I

The AsyncTask API is deprecated in Android 11. What are the alternatives?

Google is deprecating Android AsyncTask API in Android 11 and suggesting to use java.util.concurrent instead. you can check out the commit here * * @deprecate

Not able to create a new collection-type in Strapi Dashboard

I had just created a STRAPI project using , find docs here npx create-strapi-app@latest my-shop1 And then sign up to the admin portal. After signing up, I reac

Where can I find the database that I am trying to access with Hibernate?

I am browsing through a code that is not mine and I would like to manually change a few pieces of data within the database of the application. The code is using

Elasticsearch: Could not find or load main class org.elasticsearch.tools.launchers.JavaVersionChecker

I'm using CentOS and have downloaded Elasticsearch 6.2.1. I created a new user "elastic" and when I run ./bin/elasticsearch I get the error: Could not find or

find max of an input array

EDIT :: I was assuming there would be 3 array. The problem was not asking for that. I am trying to write a program from the platform Jutge.org that reads seque

Content type multipart/mixed not supported / 415 UNSUPPORTED_MEDIA_TYPE (after Spring + Spring Boot upgrade)

I was previously using the following versions of Spring + Spring Boot: <springVersion>5.0.16.RELEASE</springVersion> <springBootVersion>2.0.5.

Default implementation for hashCode() and equals() for record vs class in Java

Tried with sample code to check default behaviour of equals() and hashCode() for record vs class, but it seems behave differently for record compare to class. H

com.google.android.gms.common.SignInButton button not displaying in design using Firebase

Connected Firebase with my Android project and here is my build.gradle file code: apply plugin: 'com.android.application' android { compileSdkVersion 26

Generated Android espresso test fails to run, AndroidJUnitRunner failed to resolve: Landroidx/test/platform/io/FileTestStorage;

After recording a simple espresso test on my app the test fails to run and I'm hoping someone can guide me as to why this is happening. The resulting error is:

Load Spring Boot Classes in ClassLoader

I need to read a Spring Boot jar and load all the clases on a ClassLoader. My problem,in spring boot classes are on "/BOOT-INF/classes" directory and not on t

How to handle nullsFirst in this case

Incase the Field is empty , how can i sort the list based on Date ? import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Arr

Why should I use an interface when there is only one implementation class?

I'm new at programming and I'm learning Java. I was just wondering why I should use an interface when there is only one implementation class?