class DefaultInitialContext implements Context {

    @Override
    public Object addToEnvironment(String name, Object value) throws NamingException {
        Object result = removeFromEnvironment(name);
        environment.put(name, value);
        return result;
    }

}