No, that’s different.
That, my friend, is technically a form of type casting (To a point). You’re not making an ArrayList[], you’re making an ArrayList[], and then making the program treat it as if it’s an ArrayList.
Of course, for all intents and purposes that’s alright. But it’s technically not safe. The classic example is something like…
ArrayList[] basicList = new ArrayList[10];
ArrayList<Number>[] numberList = basicList;
ArrayList<String>[] stringList = basicList;
numberList[0] = new ArrayList<Number>();
numberList[0].add(10);
stringList[1] = new ArrayList<String>();
stringList[1].add("Hello!");
try {
System.out.println(stringList[0].get(0).length());
} catch (ClassCastException cce) {
cce.printStackTrace();
}
try {
System.out.println(numberList[1].get(0).intValue());
} catch (ClassCastException cce) {
cce.printStackTrace();
}
Which results in:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at sorting.Node.main(Node.java:40)
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
at sorting.Node.main(Node.java:45)