Is the order of records in the Trigger.new list the same in before and after trigger?
Can I rely on the assumption that:
on before r1 in the Trigger.new list on the 1st place;
on after r1 in the Trigger.new list on the 1st place;
No, you should not rely on the order of records in Trigger.new and Trigger.old. Use Trigger.newMap and Trigger.oldMap instead.
It’s a better practice to use Trigger.newMap and Trigger.oldMap because you can’t assume that directly querying the Trigger.new and Trigger.old lists will return the same number of records in the same order. Even though these lists are sorted by ID, external operations might change the number of records that are returned and make parallel list processing dangerous.