What is the difference between the fallacy of composition and hasty generalization fallacy?

The fallacy of composition can be considered a type of hasty generalization fallacy.