public boolean detach(AppState state) {
        synchronized (states) {

            // Remove it from the index if it exists.
            // Note: we remove it directly from the values() in case
            // the state has changed its ID since registered.
            stateIndex.values().remove(state);

            if (states.contains(state)) {
                state.stateDetached(this);
                states.remove(state);
                terminating.add(state);
                return true;
            } else if (initializing.contains(state)) {
                state.stateDetached(this);
                initializing.remove(state);
                return true;
            } else {
                return false;
            }
        }
    }
Detaches the state from the AppStateManager.

@param state The state to detach
@return True if the state was detached successfully, false
    if the state was not attached in the first place.
jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java