I have been researching towards the answer to a tricky question in my first year java course, specifically i need to make a program capable of both summing the elements in a generic list, and finding the highest and lowest in the list.
I am perfectly capable of completing both of these tasks individually, having T(the generic type) extend Number for summing, and Comparable for comparing. The problem occurs when I attempt to accomplish both of the tasks on the same generic type seeing as java is incapable of multiple inheritance.
In short, how could I accomplish both of these tasks while having the upper bound of T be the Number class?
Code snippets and advice are appreciated!