what exactly do you mean?
your explanation makes no sense, it's like saying: I'm writing a method add() or multiply() which has to be able to take a String as well as a Double, and has to be able to be applied to as well a String instance as a Double instance.
do you mean 'this must be able to take parameters of all kinds, as long as they're numerical'?
if so, I think generics is what you mean, but maybe you can try to explain it a bit more clear before I'm saying that's definitely the way to go.
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
Or would overloading methods do it.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
Why are those arraylists in the same class? How are they related? Are they independent and could be move to their own class with their own editing methods.
Make an abstract class or interface that they extend or implement.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
besides, why do you think methods that in the same class are not reusable?
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
just try and rationalize the why. what do you want to achieve by moving them to other classes? every method in each class is reusable, just the scope within can be adjusted by using access modifiers
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
Maybe those method definitions belong in the class they apply to, ie in Student there is a delete(Student s) method, in Course there's delete(Course c) etc etc. (These should probably be just named delete() defined as instance methods.)
In a typical controller class you will call those methods, but not define them.
If there's significant duplication between the methods in all those classes then consider inheriting them from a common superclass, or using a low-level utility class or classes that they all call on for common functions (eg database updates)
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073