The code shown below is the code used to retrieve the multiple users location from Realtime Firebase and assign to the markers on map: The structure of the real-time firebase is as follow: The result of the code is as follow: When I click on the marker, it only shows the userID of the user. I want the marker …
Tag: java
How to inject the right bean implementation according to a RequestParam in the current call
I have this Spring bean (this RestController for the sake of the example) that, depending on the country (let’s say a param that comes in), I want to inject the right implementation of the TaxpayerNameService. So, I have that TaxpayerNameService interface and two (more in the future) implementations of …
Is there any scenario where heap pollution from parameterized vararg type occurs without an explicit `Object[]` conversion?
I have been looking at various answers and articles regarding heap pollution when using non-reifiable varargs parameters. All examples I have found use an Object[] conversion followed by an array element write. The heap pollution only ever seems to occur in this manner, for example: Some other articles (such …
How can i connect to the oracle database between docker containers?
I have two containers that is created from docker-compose, one has api with springboot and the other oracle database, however it does’n connect the api to the database and I already ran out options, I tried configure the connection in the aplication.properties and also docker-compose.yml This is docker-…
Switch statement with Try Catch Exception Java
I’ve got a main menu I’m creating for a program using a switch statement. I’m try to set up Try and Catch Exception so that if a user enters a String rather than an Int, the program will tell the user this is not valid and prompt them to try again. So far, I have gotten it to tell the
Redirecting stdout from C lib in Java in JNA
I want to redirect the stdout and stderr C streams to Java, but I am struggling to do so. I used the result of this thread: https://users.jna.dev.java.narkive.com/VdgNgCIb/jna-solutions-to-catch-stdout-stderr-of-dll but it still does not work as intended. Here is my C code (I compiled it as a TestPrintf.dll l…
remove (and count) duplicates from a list
Is it possible to iterate between two iterators of a same list and remove an item within the nested iterator? Version 1 (does not work): } I get a java.util.ConcurrentModificationException, because I modify an element within the same iterator.. I can solve this issue by using another list removableItems and p…
Pi4j to use java with raspberry Pi not working
I am honestly about to just give up, i’ve tried so many different possibilities, for multiple weeks now, almost a month, of multiple problems. I am a new-ish programmer, especially with java, but i have a good understanding about java I am able to create a maven project no problem, i have no problems wi…
How to parse array inside json object in android java?
how to display array data in json object if the json data is like below. I want to display array data of Ingredient and step. This is the full API Address that I want to fetch the data https://masak-apa-tomorisakura.vercel.app/api/recipe/resep-nasi-bakar-ayam I’ve tried several ways but I can’t fi…
Java awt draw elements around a circle
I’m currently writing a little game and I came over a problem. I need to draw 64 small circles at the border of a big circle. So I want something like this: I’ve already tried many things, but they didn’t worked. How can this be done in java, using the java.awt.Component#paint() method and t…