D
dsh0105
Hi all,
I'm writing a program as part of attempt to get a grasp on the Java
language. For the part of the program I need to implement several
rules-based sorting methods to sort an ArrayList.
must implement, then create concrete classes for each of the sorting
methods to be called as needed. Since they will all implement the same
interface, they should be swapable on an as-needed basis (including at
run-time?).
This would also give the added advantage of being able to apply
multiple sort rutines to the say list in any given order.
So my question is: is my logic sound? Is this this (at least one of)
the reasons a person would use an Interface?
Thanks,
David
I'm writing a program as part of attempt to get a grasp on the Java
language. For the part of the program I need to implement several
rules-based sorting methods to sort an ArrayList.
I create an interface that defines all the methods each sort routineFrom what I understand, this might be a good place to use an Interface.
must implement, then create concrete classes for each of the sorting
methods to be called as needed. Since they will all implement the same
interface, they should be swapable on an as-needed basis (including at
run-time?).
This would also give the added advantage of being able to apply
multiple sort rutines to the say list in any given order.
So my question is: is my logic sound? Is this this (at least one of)
the reasons a person would use an Interface?
Thanks,
David