The main point with switches is that they buffer network frames. This enables a switch to receive a frame and then forward it later when the egress link is idle. This decoupling of receive and transmit operations enables a network that works with flows that are largely independent from each other and only compete for link bandwidth.
This is in stark contrast to repeater hubs that repeat incoming bits as they are received. A hub can't buffer anything, so a collision on an egress interface needs to disrupt reception on the ingress interface - the hub needs to propagate an upstream collision back to the source. This way, all nodes connected to a hub (or potentially chained hubs) form a single, common collision domain. Only one node at a time can transmit.
A switch connected to a hub (or another non full-duplex capable device) can still use half-duplex mode on any of its ports but due to the buffering between the ports, any collision will not propagate across the switch - the switch will simply retransmit the buffered frame later on. Therefore, a switch segregates collision domains or removes them completely on full-duplex links.
Note that half-duplex Ethernet and hubs are very much things of the past and only interesting for historical reasons or under very specific circumstances. Practically all Gigabit and (by standard) faster Ethernet links have dropped support for half-duplex communication and you need to use switched or point-to-point connections exclusively.