derheini
26-10-2006, 20:03
Hi Leute,
habe hier folgendes Problem:
import java.util.*;
public class MainClass {
private static ArrayList<Long> colums = new ArrayList<Long>();
private static ArrayList<ArrayList> rows = new ArrayList<ArrayList>();
private static long blub= new Long(0);
public static void main(String[] args) {
for(int i=0; i<=20; i++){
colums = new ArrayList<Long>();
for(int j=0; j<=i; j++){
blub=new Long((fak(i))/(fak(j)*fak(i-j)));
colums.add(blub);
}
rows.add(colums);
}
System.out.print("\t");
for(int i=0; i<=rows.size()-1; i++){
System.out.print("k=" + i + "\t");
}
System.out.println();
for(int i=0; i<=rows.size()-1; i++){
colums = new ArrayList<Long>();
colums = rows.get(i); <-- (Warnung!!!!!!)
System.out.print("n=" + i + " >\t");
for(int j=0; j<=colums.size()-1; j++){
System.out.print(colums.get(j).toString() + "\t");
}
System.out.println();
}
}
private static long fak(int value){ ... }
}
An der Makierten stelle bekomme ich folgende Warnung:
Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<Long>
Hat einer einen Vorschlag wie ich die weg bekomme?
Das der Code nicht 100% sauber ist weiss ich. :D
mfg derheini
habe hier folgendes Problem:
import java.util.*;
public class MainClass {
private static ArrayList<Long> colums = new ArrayList<Long>();
private static ArrayList<ArrayList> rows = new ArrayList<ArrayList>();
private static long blub= new Long(0);
public static void main(String[] args) {
for(int i=0; i<=20; i++){
colums = new ArrayList<Long>();
for(int j=0; j<=i; j++){
blub=new Long((fak(i))/(fak(j)*fak(i-j)));
colums.add(blub);
}
rows.add(colums);
}
System.out.print("\t");
for(int i=0; i<=rows.size()-1; i++){
System.out.print("k=" + i + "\t");
}
System.out.println();
for(int i=0; i<=rows.size()-1; i++){
colums = new ArrayList<Long>();
colums = rows.get(i); <-- (Warnung!!!!!!)
System.out.print("n=" + i + " >\t");
for(int j=0; j<=colums.size()-1; j++){
System.out.print(colums.get(j).toString() + "\t");
}
System.out.println();
}
}
private static long fak(int value){ ... }
}
An der Makierten stelle bekomme ich folgende Warnung:
Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<Long>
Hat einer einen Vorschlag wie ich die weg bekomme?
Das der Code nicht 100% sauber ist weiss ich. :D
mfg derheini