Shorted Arraylist with conditions

C

cmdolcet69

When working with an arraylist i need to put in some logic so that if
my A/D bit values are not moving it will remove them from the list and
move all other up that rank.

Example:

(0) 3940
(1) 3940
(2) 3938
(3) 3929
(4) 3902


In the arraylist is see that the A/D values dont move until it hit (2)
in the index, however i will need to have some way of determining that
movement.

the new arraylist should look like:
(0) 3940
(1) 3938
(2) 3929
(3) 3902

Would a for each loop do th job?
 
A

Andrew Morton

cmdolcet69 said:
When working with an arraylist i need to put in some logic so that if
my A/D bit values are not moving it will remove them from the list and
move all other up that rank.

Example:

(0) 3940
(1) 3940
(2) 3938
(3) 3929
(4) 3902


In the arraylist is see that the A/D values dont move until it hit (2)
in the index, however i will need to have some way of determining that
movement.

How about not adding a new value if it is the same as the previous value?

If newValue<>oldValue Then
myArrayList.Add(newValue)
oldValue=newValue
End If

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top