Hi I’m working on a math library and I got the Idea to make a Matrix where you can put anything in. The class you put in should have certain methods. I thougt about demanding it to extend a abstract Class Number I heard you could try something like.
class Matrix<Number>{
//Do stuff
}
I could of course try to make a interface and get the Methods there but the first option would be better.
In Processing documentation and examples, the most common place that generic types are used is with ArrayList, which is a Java built-in implemented with generics that works in exactly this way (ArrayList<Particle>, ArrayList<PVector>, ArrayList<PImage>, et cetera).
I’ve got this example of a class named ArrayQueue which is implemented using : public class ArrayQueue<E> implements Queue<E>, Cloneable, Serializable {