Whenever I debug a piece of code that includes arrays or lists of int, double, string, etc., I prefer to print them sometimes. To do this, I write overloaded printArray / printList methods for different types.
eg,
I can have these 3 methods for printing arrays of various types.
public void printArray(int[] a); public void printArray(float[] b); public void printArray(String[] s);
Although this works for me, I still want to know if it is possible to have a generic method that prints arrays / lists of any type. Can this also be expanded to an array / list of objects.
shahensha
source share