Just make your ExampleInterface generic -- ExampleInterface<T>.foo() throws T.
That technique works really well, and I don’t understand why it isn’t more widely used (or at least it wasn’t when I last used Java for serious work).
Just make your ExampleInterface generic -- ExampleInterface<T>.foo() throws T.
That technique works really well, and I don’t understand why it isn’t more widely used (or at least it wasn’t when I last used Java for serious work).