Make a class use another class?

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).

https://processing.org/reference/ArrayList.html

Here is the equivalent code from openjdk 8:

https://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/java/util/ArrayList.java

1 Like