Not sure why you incorporated `j` at all... You're getting this error because, when `i == x.size()`, and you try to get `x[i]`, your index is indeed out of bounds. Even when `i == x.size() - 1`, you are referencing `x[i+1]` with the same issue. A more typical loop might be:

    for (i = 1; i < x.size(); i++)
    {
        Engage__c record1 = x[i-1];
        Engage__c record2 = x[i];
        // logic here
    }

Or alternatively:

    for (i = 0; i < x.size() - 1; i++)
    {
        Engage__c record1 = x[i];
        Engage__c record2 = x[i + 1];
        // logic here
    }

---

Here's how the indices work:

    List - [ 'a', 'b', 'c', 'd', 'e' ]
    Index -   0    1    2    3    4

Notice that the size of the list is 5, but the highest index is 4. If you're using `i+1` as an index, the highest value you can use for `i` is 3.

If you're trying to get each pair, you can either use [`i`, `i+1`] and values of `i` 0-3, or [`i-1`, `i`] and values of `i` 1-4. I prefer the latter because it allows you to use a more concise loop syntax.