Skip to content

Tag: java

void with Generics in Java

I have a function that returns void Generic method Implementation of generic interface How can I use void in IRequestHandler<DeleteProductCommand, Void> so that I can map void from iProductService.delete(deleteProductCommand.id); Answer Option 1: Just return null: Option 2: Update the IProductService::d…

get a list of unique date from the stream grouping

I have data: Want to get a list of dates: [“12-12-2021”, “13-12-2021”] Using stream, I can get a map: I would like to convert to list in from the stream above. Answer groupingBy is not the best choice in your case. Use distinct instead. It will automatically filter out all duplicates.

JFrame keeps application running even after closing

I have a class with only static methods and one of them opens a JOptionPane error message dialogue using a JFrame object as component. This is the class + method: The ErrorPopup method is used inside a JavaFX controller and other places, called like this: Problem is that the application’s process won&#8…