What is the best (or anyway, really) of going through a bi-dimensional ArrayList<ArrayList<Integer>>
and for every Int
that is equal to 1
you leave it, otherwise you subtract 1
from it.
i.e. if arrayList.get(i).get(j) == 3
it will now be 2
and so forth, but if it is 1
it stays 1
) Only in specific columns of the ARRAYLIST<ARRAYLIST<INTEGER>>
.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Get a shovel - there's just one way to do it. Iterate over all the columns in all the rows:
If you've got an List of List it looks like this:
UPDATE:
Based on your edit, you should add an array or List of columns you want to perform this transformation on. I've added an example to the second snippet.
Iterate through all the values and use your conditional statement for performing the operation on the
true
cases.