I have a method
public String getSomething(Optional<String> name) {
    StringBuilder something = new StringBuilder("Hello");
    name.ifPresent(n -> something.append(n));
    return something.toString();
}
I use IntelliJ and it complains that you shouldn't use Optionals as parameters and only as return types. I have also read that you want to avoid side-effects in functional programming and you shouldn't manipulate objects.
So what I've been thinking is if it isn't better to do
public String getSomething(String name) {
    StringBuilder something = new StringBuilder("Hello");
    if (name != null) {
        something.append(name);
    }
    return something.toString();
}
Are there any benefits to using Optional? One benefit I can see is that the method tells you that the parameter is an optional one.
 
     
     
    