Using transistors to regulate current and voltage.
Current regulator on left. In the example, the current is limited to ~20mA. By adding a new LED in parallel, the current will stay at its limit.
Voltage regulator on right. In the example, the voltage across the LED is set up at ~2V, and it will stay close to this voltage even when the power supply voltage increases.