Suppose you have two arrayLists: A and B.
How do I create a new array which is the same size as B and stores the index values of A as integers in sequential order.
So say for example the size of B is 5 and A has 3 values.
A[0] = Ra
A[1] = Be
A[2] = Ce
B[0] = F
B[1] = M
B[2] = K
B[3] = P
B[4] = L
I want to then create in java different possible versions (say 5 versions) of an arrayC of size 5 (the same size as listB) with a sequential ordering of the indexes of listA.
So like:
arrayC[0] = 0
arrayC[1] = 1
arrayC[2] = 1
arrayC[3] = 2
arrayC[4] = 2
or
arrayC[0] = 0
arrayC[1] = 0
arrayC[2] = 1
arrayC[3] = 2
arrayC[4] = 2
are both valid combinations in arrayC. However
arrayC[0] = 0
arrayC[1] = 2
arrayC[2] = 1
arrayC[3] = 2
arrayC[4] = 2
is not.
listAis smaller, you want to randomly duplicate some values? Is that right? What iflistAis larger thanlistB? And does the actual content oflistBhave any significance? Or only its size?