I’m trying to find a solution for this matter. I have list of characters that needs to be replaced with particular character that is mapped with the original character. Ex : I have character map which hold the characters and it’s replacement value. Character Map : String that needs to be replaced …
Tag: java
ArrayIndexOutOfBoundsException when finding words in an array that and with a specific letter
I am trying to find words in an array that end with a letter ‘a’. I thought of doing it using two for loops but I keep getting integer out of bounds error. Could anyone tell me what i am doing wrong? The code: Answer You’ve got too much code for the task, which has lead to a bug creeping
Retrieving the position of the PlayerEntity class (Fabric)
I am trying to make a very (at least I think) simple mod for Minecraft that calculates the coordinates of the nearest stronghold. For this, I need the player’s position as well as its jaw. However, I am struggling to even retrieve these simple values. Here’s the code: Keep in mind that I am very (…
Display data from user uid with Firebase Database
I want to recover data from the uid and then display them in RecyclerView. I managed to recover the child/parent under Withdrawal thanks to the uid. This is what it looks like in Java: String id = … retrieves the child value. So far everything is fine except when I add this under the String id = ……
Search in a circularly-sorted array Java
i really got stuck on this and i’d love your help. I’m trying to write a method with the signature: The method gets as parameters two-dimensional array that is circularly-sorted, and a value to search for num. If the value num is in the mat array, the method returns true. If the num value is not i…
Developing job for Flink
I am building a simple data pipeline for learning purposes. I have real time data coming from Kafka, I would like to do some transformations using Flink. Unfortunately, I’m not sure if I understand correctly deployment options. In the the Flink docs I have found section about Docker Compose and applicat…
Processing a string formatted as a JSONArray
We have some code where we read a JSON file into a string and then use Json-lib to process it as follows: We now have a situation where the file is actually a JSONArray (i.e. starts with [ and ends with ]). The file passes all JSON validation tests but our code raises the following exception: We are able to
Endpoint overloading in Rest controller
I have a REST Controller in my Spring Boot application as follows: Upon trying to start the application, I get the following error: Upon changing the endpoints(in the getmapping part), this works perfectly. I fail to understand that since it does not recognise one with query param and one without as 2 separat…
How to send an array as JSON from java servlet to react frontend using fetch()?
I’ve been working on a react app. In this app, I will be sending the input from the user to the Java servlet on the tomcat server to sort it. After sorting, I’m trying to display it on a label in my react app. I’ve successfully sent it to the java servlet using fetch method() and sorted it. …
Assign random class object (image) to ImageView
I’m developing a card game, based on higher wins. From my first question here assign int value to image for compare I’ve rewritten my code but now I’m stuck on randomization of cards and assignment to ImageView. I have a class card. In MainActivity: I have array of this cards: Now I need to …