3
I would like to know how I can separate the double values, an example:
I have a Variable FormaPagto
defined as a ArrayList
,
In this variable I have 6 data:
0 - Money 1 - Debit 2 - Debit 3 - Money 4 - Money 5 - Cheque
What I want to do, separate the different values, in case we just take the values without them repeating themselves, would be like this:
0 - Money 1 - Debit 2 - Cheque
Grouping the values leaving them unique, and if possible leave in a ArrayList
.
Is there any function of the ArrayList
, who does such magic? Or what they suggest to me ?
I came to read about this function, because my entire project was done in Arraylist, would you like to know what pq should not use it? Would it be because it is limited? Or? >).
– Felipe S
Yes,
ArrayList
is limited in several respects. 1) is not generic, and therefore all elements areobject
, 2) Whenever an element is removed from the list, the cast has to be made for the correct type - Casts take the code that may fail in Runtime, and therefore the bugged code, 3) does not support LINQ extensions for data manipulation. Recommend vividly re-factoring the project, and replacing allArrayList
s forList<T>
s– dcastro
Ah, and 4) as all elements are
object
, oneArrayList
with value types (integers, doubles, booleans) will do Boxing of all elements, and this has a significant impact on performance– dcastro