-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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