I apologize in advance if this question has been asked, but I have been struggling to figure this out for a few hours now (googling everything I can) ...
I apologize in advance if this question has been asked, but I have been struggling to figure this out for a few hours now (googling everything I can) ...
I need to find a method (using streams) to return a Map<Category,Optional<ToDo>, which help me group an ArrayList and give me a ToDo object w ...
in Swift documentation at https://docs.swift.org/swift-book/GuidedTour/GuidedTour.html, there are examples about usage of optionals and unwrapping the ...
I'm trying to learn rust with egui, and I'm trying to make a list of checkboxes. Eventually, the borrow checker doesn't like this code: The comp ...
I found implemented this code (method where this part of code is used is returning Optional<File>, this part of code had to be added for verific ...
It will work if the list contains pattern:a:b: but for above example always throw an exception if that pattern is not available. In the orElse part ...
I'am currently studying for OCP and I'm simply asking why the first optional does not increment "counter" : ...
The Optional<T> type introduced in Java 8 is mostly recommended to be used for return types and results. Hence, whenever I use it in a class fie ...
I am trying to create a function with an optional argument, where the optional argument gets modified/initialized in the function. This is part of a m ...
I wanted to check if object is not null and its property is not null then call another function. I am trying to do this with Optional. Employee is a ...
class Home { String homeName; String properties; } List<Home> list = new ArrayList<>(); list.add(new Home("DefaultHome","other") ...
In SQL, COALESCE(val_1, val_2, ... val_n) is a variadic function which returns its first non-null argument, or null otherwise. Now, in C++, we have p ...
Let's say we have a class Product which has some nullable fields that are allowed to be null, for example, quantityAvailable and quantityReserved. I ...
I have a list of user id pmUserIds. For each id in the list I'm making a call getUserByUserId() and placing the result in a list of type List<Optio ...
I have to check if an attribute of an object is null or not. Depending on the above check I have to update another attribute in the same object. Is it ...
I am trying to send both or one of the optional request parameters of my API to another calling method/ function. Can someone advice me on how, if tha ...
I have an interface and its parameter can be null. To avoid null parameters and null checks common advise is to use the method overloading: In s ...
I Would like optionalFields to have type of OptionalFieldsByTopic<Topic> if generic is not provided, otherwise OptionalFieldsByTopic<T>. T ...
Is there a way to exit the method at the ifPresent? In case it is not possible, for other people with similar use-cases: I see two alternatives ...
I would like to write generic that is optional (the D in example below) and extends an interface. I can't figure out the syntax. ...