In a hub, all the ports are electrically connected, and only one device at a time can talk on the wire. If more then one talk, it creates a collision. That's why hub connections must be half-duplex. In a switch, each port is isolated, and traffic from one port is selectively sent to other ports; there are no collisions. Unlike a hub, where all the ports together are in one collision domain, on a switch, each port is a separate collision domain.