All things are lawful, but not all things are profitable.
No, because there ain't no such thing. What you showed is an array of arrays which is better than a 2D array. Java® does not support 2D arrays, though other languages might.mark cortez wrote:Ares you tying to make a 2d array? . . .
How to populate both the array list ? As it is Arraylist within Arraylist.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Ket Shah wrote:Now how can I create method addRecipeWithIngredient();? As well as how to populate list within list?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
All things are lawful, but not all things are profitable.
I didn't realise we needed a List of Lists.Knute Snortum wrote:. . .
This is where what Campbell said about lists of lists is important. You want a List of something.
. . .
Knute Snortum wrote:I would create a list of Ingredients, add all Ingredients to that list, then create a Recipe object and add the Ingredients list...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
You don't need other options. What is wrong with the way what others and myself mentioned?Ket Shah wrote:@Liutauras Vilda, Please let me know other options, so that I can store the values of recipe and their corresponding ingredients. Than later once I am done setting the initial recipe and their ingredients will have to add the recipe, remove recipe too.
No.Ket Shah wrote:. . .
So below constructor is ok to add above recipe and ingredient values?
. . .
No. Get rid of those no‑arguments constructors.Ket Shah wrote:. . .
Ket Shah wrote:Now I am able to related recipe and their ingredients. I have added few more too. Any idea how I will display all recipes and their respective ingredients?
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |