Java arraylist function | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita

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
2 Respuestas
+ 1
I advise you to take a look at the stream methodes to do this kind of manipulation. It's very powerful!
30th Jul 2022, 9:32 AM
Roland - avatar
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 ūüáģūüá≥