Skip to content

Instantly share code, notes, and snippets.

@jakewilson801
Created July 11, 2013 04:47
Show Gist options
  • Save jakewilson801/5972594 to your computer and use it in GitHub Desktop.
Save jakewilson801/5972594 to your computer and use it in GitHub Desktop.
My attempt and reading in a relation-database like file with id's
items = new ArrayList<Item>();
for(String s : lines){
String[] data = s.split("|");
items.add(new Item(Integer.parseInt(data[0]), data[1],data[2], new ArrayList<Item>()));
}
for(int i =0; i< lines.size(); i++){
String[] temp = lines.get(i).split("|");
List<Integer> ids = new ArrayList<Integer>();
String[] temp2 = temp[3].split(",");
for(String s : temp2)
ids.add(Integer.parseInt(s));
for(Integer id : ids){
for(Item ii: items){
if(ii.getID() == id){
ii.getMatches().add(ii);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment