2D Arraylist | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

2D Arraylist

Hello I have a 2D Array my problem is i need an dynamic 2D Array to remove elements inside of the inner Array

5th Jan 2020, 4:32 PM
BitScrypt
BitScrypt - avatar
15 Answers
+ 2
Was there a problem using regular array that you decided to use a dynamic array instead? Why you need to remove elements from the inner array? can you describe what is it that yoi're trying to do? an example may help clarify I hope.
5th Jan 2020, 4:50 PM
Ipang
+ 2
I am writing an calendar app with a date and note wich i want to save and load This is all working but i cant remove a date within the inner array Because of this i need a dynamic 2D Array Maybe with an 2D ArrayList But i am not sure how
5th Jan 2020, 5:01 PM
BitScrypt
BitScrypt - avatar
+ 2
Is it something similar to this- {{"04/01/20", "Yesterday was Saturday"}, {"05/01/20", "Today is Sunday"}}; Probably if you could just share your code, it would be easy for people to help.
5th Jan 2020, 5:05 PM
Avinesh
Avinesh - avatar
+ 2
You want to remove all days, months and year from index 1?
5th Jan 2020, 5:16 PM
Avinesh
Avinesh - avatar
+ 2
You can use HashMaps in Java, the most simple and straightforward way.
5th Jan 2020, 5:19 PM
Avinesh
Avinesh - avatar
+ 2
BitScrypt would you like an example code? Considering that you can build on that.
5th Jan 2020, 5:41 PM
Avinesh
Avinesh - avatar
+ 2
Rishi, It's been a year since the date of the thread, I don't even remember why I asked that at the time. I saw your code where you used `ArrayList`, as I understand it, it is one of Java dynamic containers. And as I understand regular arrays are static, in that they are not resize-able, and unable to grow or shrink as necessary.
26th Aug 2021, 1:22 PM
Ipang
+ 1
You have a 2D array and you need a dynamic 2D array to remove elements inside of the inner array? Have you wrote it right?
5th Jan 2020, 4:45 PM
Avinesh
Avinesh - avatar
+ 1
Index 0 {{Days}{Months}{Years}} 1 {{1}{5}{2020}} 2 {{3}{12}{2020}} For example i want to delete date on Index 1 but i can only delete the last element with a normal Array
5th Jan 2020, 5:11 PM
BitScrypt
BitScrypt - avatar
+ 1
Ipang what you mean by "Was there a problem using regular array that you decided to use a dynamic array instead?"? Because, there are no non-dynamic arrays in Java right?
26th Aug 2021, 9:20 AM
Rishi
Rishi - avatar
+ 1
Ipang yeah that's right. Both ArrayList and regular arrays are dynamical allocated(on the heap). Only that, normal array don't have a way to be resized
26th Aug 2021, 2:40 PM
Rishi
Rishi - avatar
0
yes
5th Jan 2020, 5:17 PM
BitScrypt
BitScrypt - avatar
0
Ok i am trying it thank you for your help
5th Jan 2020, 5:22 PM
BitScrypt
BitScrypt - avatar
0
Would be nice
5th Jan 2020, 5:42 PM
BitScrypt
BitScrypt - avatar