Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm trying to create a 2d ArrayList(can't use Arrays). It will be an Arraylist of Arraylist ArrayList correlationMatrix = new ArrayList (); ArrayList newcorrelationMatrix =

I'm trying to create a 2d ArrayList(can't use Arrays). It will be an Arraylist of Arraylist

ArrayList> correlationMatrix = new ArrayList>(); ArrayList> newcorrelationMatrix = new ArrayList>(); ArrayList lastCorrelationMatrix = new ArrayList(); for (int i=0;i

correlationMatrix is filled with 5 ArrayList and the findCorrelation method takes 2 ArrayList as arguments. I'm trying to fill newcorrelationMatrix in a way that each row is each iteration of lastCorrelationMatrix. My thought process was that for example for i=0 fill lastCorrelationMatrix, and add that Arraylist to newcorrelationMatrix and then clear the content of lastCorrelationMatrix and go to i=1 and add the new lastCorrelationMatrix to newcorrelationMatrix, and so on. But for some reason is just printinig the i=4 value repeated 5 times. The method findCorrelation works, the purpose of me creating newcorrelationMatrix is that lastCorrelationMatrix after the method call fills it 20 elements and I need them to be output in a 5x4 matrix format. What am I doing wrong in this code, thanks.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

=+b. What proportion of times are between 2500 and 5000?

Answered: 1 week ago