Category "java"

How to convert an XML structured-like object to a JSON string in Java?

So I have an XML structured object (Java) and need some help to convert it to a JSON string without using any library and in an iterative way. E.g <root>

Alternative to AsyncTask with HTTP POST request because it was deprecated

I made an android app 5 years ago that use AsyncTask to create an HTTP POST request to send a receive data from server, with two parameters. Any help would be a

How can I create immutable DTOs using Jackson but without annotions?

Jackson can deserialize JSON data into immutable objects. But by default the constructor or static factory method parameters have to be specified either using @

NoClassDefFoundError on org.springframework.jms.listener.DefaultMessageListenerContainer on start Application

I have big Gradle project. When i ruunng application gradlew - bootRun or run Debug on InteljIdea I got exceptions java.lang.NoClassDefFoundError: org/springfr

React Native - TypeError: n.createContext is not a function. (In 'n.createContext(o.default)', 'n.createContext' is undefined)

I'm trying to implement React Native into an existing Android application. I follow the steps in the official documentation and I have ended with the following

Edited: Retrofit and CompletableFuture, is there a way to not rely on the underlying connection pool?

Original question: OkHttp, is there a way to not rely on a connection pool? Hey OkHttp users and/or contributors! Is there a way to use an OkHttpClient withou

Store a variable in Android

Is there any way to have a boolean that goes true when successful login and false when not, and to be able to access it and change its value in the activities?

Adding all elements of an array except the element at index with O(n) complexity

This is what i came thru a problem in some coding test. problem statement was like that we have to add all the elements of an array except the element at the i

bus properties settings ignored

I had cxf.xml file: <beans .... <cxf:bus> <cxf:features> <cxf:logging/> </cxf:features> </cxf:bus> </beans&

why fingerprintsimilarty in my code does not work?

I'm creating an application to recognize the sound of two wave files, for doing this I have found that "Musicg" library is used for that purpose. so I just writ

Count Occurrences of Seven Integers in Array

I have written the code below and it has comments attached. The application is to read seven integers entered by the user. The application then prints out the n

I need to send the request correctly, but I don't know how to get the required values from objects

How to get a new list from the list of objects? I need a new list of objects to POST request this list of objects i get from response: { "success": true, "b

How to determine what Java Jenkins is using to run and point it to the correct location (Java 11)

I've looked all over for this answer but cannot find it, as most of the answers are how to add JDK to Jenkins for usage within a test. I'm looking for how to en

how to display floating window without permission?

i tried to display floating window in android 10 / Core M01 using WindowManger, but i am not able to get "Display over apps" permission:- i tried to use "Windo

Kafka streams - Concatenate Predicate based on dynamic number of conditions

I'm a bit new in Java so I would appreciate advice to deal with multiple conditions in Kafka Predicates. I've the following code which I'm able to have dynamic

Why all java utils for dumping heap are not working? How to dump heap?

I'm tired to trying to dump java heap when I need it. Any time when I could do that none of utils are not able to do that. I'm trying jmap, jvisualvm, jconsole,

What are sealed classes in Java 17?

Today, I updated my Java version from 16 to 17, and I found that sealed classes is a new feature in it. I think it can be declared like this: public sealed clas

How can we test for the N+1 problem in JPA/Hibernate?

I have a N+1 problem, and I’d like to write some kind of automated regression test because it impacts performance very much. I thought about spying the E

Apache Ignite No data inserted while using cache.put method with BinaryObjects

After going through several posts on getting and putting data into a SQL table in appche ignite with the help of BinaryObjects I wrote below code for a test. Th

Updating notifications after being added

I want to update the content for a reminder after it has been added before being received by the user. After setting a reminder through AlarmManager using the d