0

Java arraylist function

I am planning to create a method which mainly look through some of the elements from an arrayslist and modify it and then transfer to another arraylist. So my question would be should I include this both two arraylist as the parameter of method or just one arraylist will do?

29th Jul 2022, 10:37 AM
Kawai
2 Answers
+ 1
I advise you to take a look at the stream methodes to do this kind of manipulation. It's very powerful! https://www.geeksforgeeks.org/stream-in-java/
30th Jul 2022, 9:32 AM
Roland
Roland - avatar
0
If another list is a new modified list then no need to pass 2. Create new and modify it.. return new. If 2nd list is already existing list then you need pass two lists.. Anyways it's depends on context.. You can do in both ways.. Also hoping, You can improve it after you got the correct output.. Hope it helps...
29th Jul 2022, 11:08 AM
Jayakrishna šŸ‡®šŸ‡³