I m learning about java optional wrapper, to do so I m reading the following tutorial
however I have a simple question that is not answered in the article: in item 25: Avoid Using Identity-Sensitive Operations on Optionals they are mentioning to NEVER use an optional object in a synchronized way like this:
Optional<Product> product = Optional.of(new Product());
synchronized(product) {
...
}
but there is no explanation why, so please would any one here explain to me why this is a bad practice ???