//Unnecessary null check (result != null && result instanceof KeyValuePair) //Efficient approach (result instanceof KeyValuePair)