Since get() returns an empty Optional if the index is not present, we can combine these two into a single get() operation and save the cost of a virtual call.