Lately I've been considering creating a sort of "toolbox" for myself in java. It would consist of standard algorithms and data structures that are frequently used, but a pain to implement. (I'm thinking graphs, trees, etc)
What would be the best way to do this? I was thinking about either using generics or using an abstract class. This way I could have any object that wanted to use the methods simply provide a getGraphData() method or something similar.
I think that generics might be better though because an abstract class would force me to inherit from it, which could become problematic.
This is called a library...
General purpose stuff should be in the Java library. If some stuff that you want is missing, you might try additional libraries such as Google Collections. You might also want domain-specific libraries.