I have created a generic interface which is implemented by certain classes. It looks like:
public interface KingdomElementService<T> {
  public T findById(Long id);
  public T save(Optional<T> object);
  public void update(T t);
}
My IntelliJ yells at save, writing "Optional is used as a parameter.". I understand the logic that it's weird to take in something that may exist and may not. Why I considered to do this is to rewrite some
 if(something){
   do();
 }
 else{
 throw new Expression();
 }
to
something.orElseThrow(Expression::new);
Now I am wondering if my solution of using an Optional is an overkill here or not. What do you think? Should I consider changing it back?
 
     
     
     
    