List of usage examples for java.util Hashtable remove
public synchronized V remove(Object key)
From source file:org.sakaiproject.site.tool.SiteAction.java
/** * Sets selected roles for multiple users * /* w w w .ja va 2 s . c om*/ * @param params * The ParameterParser object * @param listName * The state variable */ private void getSelectedRoles(SessionState state, ParameterParser params, String listName) { Hashtable pSelectedRoles = (Hashtable) state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES); if (pSelectedRoles == null) { pSelectedRoles = new Hashtable(); } List userList = (List) state.getAttribute(listName); for (int i = 0; i < userList.size(); i++) { String userId = null; if (listName.equalsIgnoreCase(STATE_ADD_PARTICIPANTS)) { userId = ((Participant) userList.get(i)).getUniqname(); } else if (listName.equalsIgnoreCase(STATE_SELECTED_USER_LIST)) { userId = (String) userList.get(i); } if (userId != null) { String rId = StringUtils.trimToNull(params.getString("role" + userId)); if (rId == null) { addAlert(state, rb.getString("java.rolefor") + " " + userId + ". "); pSelectedRoles.remove(userId); } else { pSelectedRoles.put(userId, rId); } } } state.setAttribute(STATE_SELECTED_PARTICIPANT_ROLES, pSelectedRoles); }