Java Utililty Methods Map Remove

List of utility methods to do Map Remove

  1. HOME
  2. Java
  3. M
  4. Map Remove

Description

The list of methods to do Map Remove are organized into topic(s).

Method

boolean remove(Map map, String key)
remove
Iterator<?> it = map.keySet().iterator();
while (it.hasNext()) {
 Object keyObject = it.next();
 if (keyObject instanceof String) {
 String k = (String) keyObject;
 if (k.compareTo(key) == 0) {
 it.remove();
 return true;
...
boolean remove(Map> map, K key, V value)
remove
boolean removed = false;
Set<V> values = map.get(key);
if (values != null) {
 removed = values.remove(value);
 if (values.isEmpty())
 map.remove(key);
return removed;
...
void remove(Map map, Collection keys)
if (map == null || map.isEmpty()) {
 return;
if (keys == null || keys.isEmpty()) {
 return;
for (K key : keys) {
 if (key == null) {
...
V remove(Map map, K key)
Removes the mapping for a key from this map if it is present.
if (map == null)
 return null;
return map.remove(key);
void removeAll(final Map target, final Iterable keys, Collection values)
Removes all the given keys from the given map and adds their corresponding values to the given collection.
if (keys != null) {
 removeAll(target, keys.iterator(), values);
void removeAll(Map map, Set keys)
remove All
for (K k : keys) {
 map.remove(k);
boolean removeAllFromCollection(Map> map, Object key, Collection values)
remove All From Collection
Collection list = (Collection) map.get(key);
if (list == null) {
 return false;
} else {
 boolean result = list.removeAll(values);
 if (list.isEmpty()) {
 map.remove(key);
 return result;
Map removeAllNullValueEntry(Map source)
remove All Null Value Entry
if (null == source) {
 return new HashMap<R, T>();
Map<R, T> map = new HashMap<R, T>();
for (Entry<R, T> entry : source.entrySet()) {
 if (null == entry.getValue() || null == entry.getKey()) {
 continue;
 map.put(entry.getKey(), entry.getValue());
return map;
boolean removeAndCleanFromCollectionMap(KeyT key, ValT toBeRemoved, Map> map)
NOTE Same as removeObjectFromCollectionMap but remove key if Collection is empty.
Collection<ValT> obj = map.get(key);
if (obj == null) {
 return false;
Collection<ValT> coll = obj;
final boolean ret = coll.remove(toBeRemoved);
if (coll.isEmpty()) {
 map.remove(key);
...
void removeApiUuidMap(String apiName)
remove Api Uuid Map
apiUuidMap.remove(apiName);


AltStyle によって変換されたページ (->オリジナル) /