I am trying to understand the merge method. I have a map of <Character, List<Integer>>. I want to add the indices to the list of the appropriate key. I want to use the merge method to do so. I tried the following method. I am getting UnsupportedOperationException. What is the best way to do so using the merge method? Answer
Connecting to ES with Spring Data Elasticsearch (reactive) gives error host not reachable
I’m running on an aws-elasticsearch (with OpenSearch 1.1.x) service and im trying to connect with it from a spring application using spring-data-elasticsearch, according to the doc i configured the bean as it says. on my local i used a ssh tunnel from my aws account. i used this command: so i can connect with OpenSearch dashboard over localhost in my
Initial heap size set to a larger value than the maximum heap size
Im trying to start a .jar file with these args: and I get the error: Answer Override the current JAVA_OPTS value I am suggesting to keep on rate 1 to 2 between Xms and Xmx
Java, my own copy() method would not work
I am learning java and came upon a small problem, my copy() method will not work. I work based on a UML diagram and I am pretty sure that I’m doing everything correctly. Here is the code: Constructor: copy() method: The error flashes at the parantheses FileName() it says: ‘FileName(java.lang.String, java.lang.String)’ in ‘Exam_Practice_4.FileName’ cannot be applied to ‘()’ Here is
Checking if an object exists in a list Java Stream
I have 2 entity. One of them User, and the other one is Followers. I’m trying to make a follower system like Twitter. User can follow another user but, i want to check if user followed, don’t do it again. This is my Follower Entity : And this is the Service class : As you can see, I got the
Using set and get methods in java
In my programming class, the teacher said we have to implement a class and use get methods but did not mention set methods in the description. Are they always used or should be used together? This is what I’ve written so far: Answer No, setters are not needed at all when implementing immutable classes/objects: Don’t provide “setter” methods — methods
How to get the next n fridays which are the first, second or third friday in a month?
I need to find the next n Fridays but want to exclude 4th and possibly 5th Fridays, i.e I want to get the next n Fridays which are 1st, 2nd or 3rd of each month. I have found a way to stream over the next n Fridays (example next 10 Fridays): Output: But I need to exclude for example 2021-10-22
Building a Recursive Data Structure with Spring WebFlux
I have a REST API that is built with the Spring WebFlux framework, and I have an endpoint which returns a Flux<ChannelResponse>, where ChannelResponse is a tree-structured object, as shown below: Now, I don’t have much experience with the reactive programming paradigm, but this is how I would implement such an endpoint with synchronous logic, such that each top-level channel
needing help understanding this array method call [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I just learned recently arrays. This exercise calls to return an average. I am trying to figure out how to
Set a transient object variable without serializing in Camunda
I have a process in Camunda that doesn’t have any user tasks. Iy has only some service tasks. I want to set a transient Object variable and then get in several tasks and manipulate it but Camunda forces me to make it implement the Serializable interface. My code is: but get the following exception: Is there any way for setting