Types and Polymorphism: CS 305 & 503 Lecture notes

Data Structures & Algorithms Lecture Notes

10 September 2009 • Types and Polymorphism


For example, sort(java.lang.object[])() accepts an array of objects rather than an array of Comparables. It’s not clear why this is so; the sort is eventually going to downcast the array elements to Comparables, which means a successful sort required an array of Comparables. Replacing sort(Object []) with sort(Comparable []) would seem to be backwards compatible, at least for the successful cases.


This page last modified on 24 January 2006.