private static State getSameParent ( final State parent , final MetaKey key ) { State current = parent ; while ( current != null ) { if ( current . key . equals ( key ) ) { return current ; } current = current . parent ; } return null ; }
Traverse up from the provided parent and find the first which uses the same key