Heat is energy in transition, from higher temperature body to body at lower temperature.
If "no loss of energy" then energy absobed by cooler body = energy exhausted by hotter body
For example if m gram ice cube is droped in M gram hot water then to calculate the final temperature of the mixture following step by step method may be employed:
if value of M and its temperature is sufficient enough to melt the ice
then heat required to melt the ice is mL where L is latent heat of fusion for ice.
heat required to increase the temperature of this m gram 0 degree water is ms(T - 0) where s is the specific heat for water and T is the final temperature of the mixture.
Heat exchausted by M gram hot water during cooling down from T1 to T is MS(T1 - T).
as per calorimetry MS(T1 - T) = mL + msT
Note- First ice will fully melt only then its temperature will start increasing provided energy is availble with hot water in other words it is hot enough.