WHa happens in future when you want switch out implementations of a List, having a handle to a list means you can use constructs like linked lists.
And whats wrong with using typesafety? we know the solutions needs a collection of Integers? so we should let the compiler enforce this no?
Dj Jester,
you need walk before you run, when i went to uni if an assignment said use an Array i used an array, if the assignment said use a Vector, i used a vector.
And if your going to introduce ArrayList why not declare with type safety?, and why not keep handle to the interface (List)...
Its better when you solve specific problems like this to open up the program so it works under different constraints. so you might want to take 10 numbers between 1 and 5 without big code change. below is an example expanding the problem domain to make the program more flexible.
This approach...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.