Skip to content

Instantly share code, notes, and snippets.

@javierhonduco
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierhonduco/88d44eecb197bb10347a to your computer and use it in GitHub Desktop.
Save javierhonduco/88d44eecb197bb10347a to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
class Untitled {
public static Double[] fake_data = {2.3, 5.2, 4.5};
public static Integer fake_rows = 5;
public static ArrayList<ArrayList> linelist;
public static void run(){
linelist = new ArrayList<ArrayList>();
for(int i=0; i<fake_rows; i++){
ArrayList<Double> row = new ArrayList<Double>();
for(int j=0; j<fake_data.length; j++){
row.add(fake_data[j]);
}
linelist.add(row);
}
System.out.println(linelist);
ArrayList<Double> row = linelist.get(0);
for(Double point: row){
// Do things with the point
}
for(Double point: linelist.get(0)){
// Do things with the point
}
}
public static void main(String[] args) {
run();
}
}
@javierhonduco
Copy link
Author

Untitled 2.java:22: error: incompatible types
        for(Double point: linelist.get(0)){
                                      ^
  required: Double
  found:    Object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment