I have been in both situations:
In both cases the project s
Avoid creating your own exception. Use the below ones that are already there.
IllegalStateException
UnsupportedOperationException
IllegalArgumentException
NoSuchElementException
NullPointerException
Throw unchecked exceptions.
public void validate(MyObject myObjectInstance) {
if (!myObjectList.contains(myObjectInstance))
throw new NoSuchElementException("object not present in list");
}