So, I'm normally a ruby programmer, so my grasp of Java conventions is shaky at best. If I have a class A and want to define a method to add two instances of that class, what's the convention on the behaviour and return type?
public class A
{
//...
public NotSureWhatTypeItShouldReturn add (A that) { /* ... */ }
Should I
- return a boolean indicating success and modify the target, or
- return a modified copy of the target and throw an exception on error
Which fits with the normal Java convention for this kind of method?