How to find the minimum element of a matrix of objects in java?

advertisements

I have a Matrix class that has the following attributes: number of Lines, number of columns and a matrix of Objects.

I have to find the minimum element of the matrix of Objects. How could I do that if I don't know what my Objects will be in JAVA?


You can use either the comparable or comparator functions to, effectively sort arrays of objects by a specific value. You will, depending override the compare to value and select an instance field to make comparisons with.