A bit of mixed up things
Switches vs Hubs
They perform similar functions: end hosts plug into them in a LAN. The end hosts can communicate to each other through them via Ethernet.
Switches / Hubs are connected to each other with Ethernet cables as well.
Duplex Modes and Shared Collision Domain.
Hubs operate in half-duplex mode: attached hosts cannot send and receive data at the same time, but they have to do it one at a time.
All hosts share the same collision domain (one device transmits at a time). If two hosts transmit at the same time a collision will occur.
Hosts use Carrier-Sense Multiple Access with Collision Detections (CSMA/CD) to detect collisions and resend.
Switches can operate in either full-duplex or half-duplex mode (in practice they are always in full-duplex).
Attached hosts can both send and receive data at the same time, and all hosts have their own dedicated collision domain. Collision Detection is not required.
OSI Layers
Cisco devices operate on particular OSI Layers:

Hubs operate at Layer 1: they are not MAC address aware. Whenever a frame is received, it is flooded out all ports apart from the one it was received on. All attached hosts must process all packets.
Switches operate at Layers 2: they areMAC address aware. Whenever a fram is received, the switch will look at the source MAC address in the LAyer 2 Ethernet header. The learned MAC address will be added to the switch's MAC Address Table, which maps MAC addresses to ports. If a unicast frame is later received with a known MAC address as the destination, the switch will send the frame out only the relevant port, which is better for performance and security: only the device that is supposed to have the frame will receive it. Whenever a frame is received for the broadcast address or an unknown unicast destination (not present in the MAC table) it will be flooded out all ports apart from the one it was received on.