Skip to content
Advertisement

Category: Questions

Java Swing unable to remove a component

I am trying to build a quiz game that rerender itself after user click on the button with answer. I have added an action listener to 4 buttons. When the button is clicked, it is suppose to reach the outer class which extend JFrame and remove the QuestionPanel that extends the JPanel. And then create a new QuestionPanel and add

Java generics impossible assignment?

Every time I think I understand generics better (and can answer without compiling), I get to an example where this theory breaks. Here is a very simple example: And two invocations: To me, none of the invocations should compile. A String is not a supertype of List. Still, the second one compiles. But let’s suppose that this happens because the

How to process object with map for CSV output

I have a set of below Objects, which i need to write to CSV: Above set can have a map with two, three or four values. Output of CSV required: I started with below snippet to print out: But above is creating a two column csv with userId and behaviours printing all map object behaviours. How to achieve above type

How do I make sure my apache Ignite 2.x distributed cache puts are asynchornous

Below I have a distributed cache example using apache ignite. I want to make it so when I do a cache put operation: cache.put(i, new X12File(“x12file” + i, LocalDateTime.now().toString())); that it is completely asynchronous. Meaning my put operation should be super fast, and the pushing to the rest of the cluster should happen in the background not inconveniencing the user.

How to avoid Jackson escaping double quotes in Java?

I am working on a project and wanted to rewrite some code written in Gson to Jackson using ObjectMapper. So I am trying to create a JSON string using some properties as below: Expected result: Actual: So once I create a JSON String using Jackson, it turns out it is escaping double quotes for field names and values and adding

Apache Ignite: Caches unusable after reconnecting to Ignite servers

I am using Apache Ignite as a distributed cache and I am running into some fundamental robustness issues. If our Ignite servers reboot for any reason it seems like this breaks all of our Ignite clients, even after the Ignite servers come back online. This is the error the clients see when interacting with caches after the servers reboot and

Automatically replacing with var using IntelliJ

I’m migrating some pre Java 10 code and I’m wondering if IntelliJ offers a way to automatically refactor the code to replace the variable declarations that uses the actual type with var wherever it’s possible. The code is full of stuff like: And I would prefer: I already looked in IntelliJ’s settings (Code Style/Inspections) and couldn’t find anything. Answer Go

Advertisement