The functionality of this class remains exactly the same. However, now
we're instead using an array list of Key classes (defined inside the
Keyboard class as private static).
The performance of operations on this class doesn't really change since
now you're creating Key objects and comparing them instead of creating
Integer objects and comparing them.
The difference that got rid of the boolean array is the fact that every
key has a boolean field called "pressed" which is set to true once the
method keyTyped has been called on that key. This allows us to only have
as many booleans as are keys being pressed at any given moment (which on
most keyboards is a very small number).
The functionality of this class remains exactly the same. However, now we're instead using an array list of Key classes (defined inside the Keyboard class as private static). The performance of operations on this class doesn't really change since now you're creating Key objects and comparing them instead of creating Integer objects and comparing them. The difference that got rid of the boolean array is the fact that every key has a boolean field called "pressed" which is set to true once the method keyTyped has been called on that key. This allows us to only have as many booleans as are keys being pressed at any given moment (which on most keyboards is a very small number).