I believe a Core i7-7700 at 3.6GHz and 4770k at 4.2GHz are equal. So I would think that the Core i7 4770k is better especially if you have a good overclock on it.
I say it depends, because value and upgradability goes to the i5 7400, but i dont know why you picked the i5 7400 instead of the i5 7600k.
What are you planing to do with the CPU?