I just saw that someone posted the following post in ugly code:
public static Tuple<ArrayList<ArrayList<ArrayList<String>>>, ArrayList<ArrayList<ArrayList<String>>>> split( ArrayList<ArrayList<ArrayList<String>>> data, [..]);
(layout with me, in a ridiculous attempt to get this semi-readable)
I was looking for a way to make this look a bit like this (non-functional) code:
TypeParam T = ArrayList<ArrayList<ArrayList<String>>>; public static Tuple<T,T> split( T data, [..]);
So far, the best solution I have found is to define a class (in this example, class Data ) that extends ArrayList<ArrayList<ArrayList<String>>> , which makes the code look like this:
public static Tuple<Data, Data> split( Data data, [..]);
Although this method is quite satisfactory, I do not want to give up the possibility that there is some way to use generics that I am missing, and I am wondering if Java has a way to do this even more aesthetically.
Another solution I'm playing with is to use the Annotation Handler to fix this for me, but I feel it misses a certain simplicity.
source share