I have read many posts about this problem and the answer is usually "replace your ball valve washer". I have had a look in my toilet and I do not exactly which part is the ball valve, although I do know which part of the mechanism causes the water hammer. Also the parts that causes the water hammer are made from plastic and do not have an existing washer in the assembly.
I get water hammer through my pipes just as the cistern is at the end of its refill. The long arm attached to the float has what looks like a plastic screw mounted on it at the opposite end to the float. As the float rises this screw pushes a "piston" into a "cylinder" (a valve??) which eventually stops water flowing into the tank. If I flush my toilet and push the piston with light pressure I can reproduce the water hammer effect. The fact that the flowrate into the tank slows as the piston is pushed in makes the water hammer noise last longer.
The piston and cylinder (valve?) are made from a white plastic. The piston fits loosely but I cannot pull it out of the cylinder. Does the washer go into the cylinder before the piston, preventing the piston from vibrating as it is slowly closed? B&Q have a ball valve diaphragm washer for
98pence