Inside the hub, all ports are connected to others. The network via hub connects all stations together, sharing the same path with much possibility of collision. It means that when 5 PCs connected to a 100Mbps hub, these 5 PC will share the 100Mbps and each PC could obtain 20Mbps bandwidth. Also, when one port in a hub receives a data frame, it will copy this frame to all ports in that hub. The features will cause serious collision when the traffic increases.
Inside the switch, the ports are connected to each other only when addressed. The network via switch connects stations only when they access each other. Each port on a 100Mbps switch has dedicated 100Mbps bandwidth. A switch will learn the attached PC's MAC address. When receiving a data frame, it will check MAC table. If the switch finds the MAC address in the table, it will transfer the data directly to that port instead of copy to all ports. That's why there is seldom collision in a switch.