Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
I've sometime had the need to find a string after a separator, lookup
an object based on the result value and then use it to process
something, like:
String after = ObjectHelper.after(key, ":");
if (after != null) {
MyStuff s = cache.get(after)
if (s != null)
}
So I wonder whether it makes sense to add a 'fluent' variant to these
functions to impement such pattern, like:
<T> Optional<T> after(String value, String delimiter,
Function<String, T> function)
The we could do something like:
ObjectHelper.after(key, ":", cache::get).ifPresent(s ->
s.doSomething(exchange));