Does resistance affect a capacitor charging from another capacitor?
The resistor makes the charge redistribution  slower, but finally the voltage is the same in both cases. The charge remains constant in both cases. In the first case probably the energy waste is more via radiation and less via heating the wires. In the second case the most is dissipated in the resistor, but the total energy loss is the same in both cases.

You can calculate the final voltage VT = Q/15uF where Q is the total original charge; Q = 10uF * 5V

The loss is the energy difference between 0.5 * 10uF* (5V)^2 and

0.5 * 15uF *(VT)^2

In pure theory with no losses in anywhere, the circuit gets never stable. But in the practice the oscillation fades away very soon due the losses and my formulas are based on that.