...
Code Block | ||
---|---|---|
| ||
class BadIterate { public static void main(String[] args) { List<String>List<String> list = new ArrayList<String>ArrayList<String>(); list.add("one""one"); list.add("two""two"); Iterator iter = list.iterator(); while(iter.hasNext()) { String s = (String)iter.next(); if(s.equals("one""one")) list.remove(s); } } } |
Compliant Solution
...
MSC32-J. Make sensitive classes noncloneable 49. Miscellaneous (MSC) 99. The Void (VOID) MSC34-J. Do not base critical decisions on IP addresses or DNS lookups