Skip to content

Instantly share code, notes, and snippets.

@eleanor-em
Created September 12, 2019 00:57
Show Gist options
  • Save eleanor-em/dba4261b635aad62a8614b5015d90465 to your computer and use it in GitHub Desktop.
Save eleanor-em/dba4261b635aad62a8614b5015d90465 to your computer and use it in GitHub Desktop.
getTools example for the Recipe class
int size = 0;
for (Food f : food) {
size += f.getTools().length;
}
Tool[] tools = new Tool[size];
int i = 0;
for (Food f : food) {
for (Tool t : f.getTools()) {
tools[i++] = t;
}
}
return tools;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment