Removes objects of an assignable type. @param c the type of object
(Class<?> c)
| 147 | * @param c the type of object |
| 148 | */ |
| 149 | public void removeObjects(Class<?> c) { |
| 150 | HashMap<String, Object> map = new HashMap<>(myObjects); // clone the object map |
| 151 | Iterator<Object> it = map.values().iterator(); |
| 152 | while (it.hasNext()) { // copy only the obejcts of the correct type |
| 153 | Object obj = it.next(); |
| 154 | if (!c.isInstance(obj)) { |
| 155 | it.remove(); |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Removes an object from the manager. |