G
Gary Newell
Hi -
I need some Java 5 help. The following code snippet worked fine in Java
1.4.2.
I'm setting up an array of ArrayLists. Each ArrayList contains Doubles.
The following code is generating a compiler time warning.
code:
- - - - - - - - - - - - - - - - - - - - - - - - - - -
import java.util.*;
public class arrayOfArrayLists {
public static void main(String args[]) {
ArrayList arrayListDoubles[] = new ArrayList [ 5 ];
for( int j=0; j<arrayListDoubles.length; j++ ) {
arrayListDoubles[ j ] = new ArrayList<Double> ();
}
// start loading values into the first arraylist
arrayListDoubles[0].add( new Double( "100" ) );
}
}
- - - - - - - - - - - - - - - - - - - - - - - - - - -
compiler warning:
- - - - - - - - - - - - - - - - - - - - - - - - - - -
C:\temp>javac -d . -Xlint:unchecked *.java
arrayOfArrayLists.java:13: warning: [unchecked] unchecked call to add(E) as
a member of the raw type java.util.ArrayList
arrayListDoubles[0].add( new Double( "100" ) );
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Any idea how to get each of the ArrayLists in the Array to be expecting
Doubles?
Thanks!!
Gary
I need some Java 5 help. The following code snippet worked fine in Java
1.4.2.
I'm setting up an array of ArrayLists. Each ArrayList contains Doubles.
The following code is generating a compiler time warning.
code:
- - - - - - - - - - - - - - - - - - - - - - - - - - -
import java.util.*;
public class arrayOfArrayLists {
public static void main(String args[]) {
ArrayList arrayListDoubles[] = new ArrayList [ 5 ];
for( int j=0; j<arrayListDoubles.length; j++ ) {
arrayListDoubles[ j ] = new ArrayList<Double> ();
}
// start loading values into the first arraylist
arrayListDoubles[0].add( new Double( "100" ) );
}
}
- - - - - - - - - - - - - - - - - - - - - - - - - - -
compiler warning:
- - - - - - - - - - - - - - - - - - - - - - - - - - -
C:\temp>javac -d . -Xlint:unchecked *.java
arrayOfArrayLists.java:13: warning: [unchecked] unchecked call to add(E) as
a member of the raw type java.util.ArrayList
arrayListDoubles[0].add( new Double( "100" ) );
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Any idea how to get each of the ArrayLists in the Array to be expecting
Doubles?
Thanks!!
Gary