Created
September 12, 2019 00:57
-
-
Save eleanor-em/dba4261b635aad62a8614b5015d90465 to your computer and use it in GitHub Desktop.
getTools example for the Recipe class
This file contains 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
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