I tried to define an array of linked list in Java like the following, which compiled fine but it generated 2 warning messages.
LinkedList<Long> [] hashtable = new LinkedList[10];
warning: [rawtypes] found raw type: LinkedList
LinkedList<Long> [] hashtable = new LinkedList[10];
^
missing type arguments for generic class LinkedList<E>
where E is a type-variable:
E extends Object declared in class LinkedList
HashTable.java:13: warning: [unchecked] unchecked conversion
LinkedList<Long> [] hashtable = new LinkedList[10];
^
required: LinkedList<Long>[]
found: LinkedList[]
So, I tried
LinkedList<Long> [] hashtable = new LinkedList<Long>[10];
But this time it would not even compile and generate this error instead.
HashTable.java:13: error: generic array creation
LinkedList<Long> [] hashtable = new LinkedList<Long>[10];
^
1 error
So, how should I define my array of linked list properly ?