Change Min and Max to use generics based on Effective Java