Resistor and LM317L act as a current regulator set to 40 ma. Current will flow from the battery through one pair of LEDs, and then to the regulator, through the other pair of LEDs and finally back to the battery. Noise on the power supply lines filtered out by the capacitor. To make the current through them is roughly equivalent, the LED pairs must be matched. To improve the balance, small resistors could be placed in series with each of the four LEDs, but the parts count would go way up.
Seven Component Regulated LED Lamp circuit schematic