How do you manage key release events?

I’m trying to figure out how to send a key release event from a component. The KeyListener class has keyPressed, which includes information about which key was pressed, but no keyRelease function. There is keyStateChanged, but the problem with that is it oddly does not include the KeyPress data.

So do I need to keep track of all the keys that are pressed with keyPressed, then loop though those values on keyStateChanged to check which ones are up? Seems inefficient. Is there a better way?