3 ms·
This is horrible design. It’s mutable and your returning Boolean values for whether or not your operation was a success. Use exceptions. If you want to take th
by vips7L 3y ago
This is horrible design. It’s mutable and your returning Boolean values for whether or not your operation was a success. Use exceptions.
If you want to take the pure public data approach the better approach would probably be:
record Age(int value) {
Age {
if (value < 0 || value > 150)
throw new IllegalArgumentException(value);
}
}
Ultimately what we need is Valhalla to deliver primitive classes.