Restrict the values in an arraylist?
<p>If my list can contain values of 1 or 2 in it and I get the list at runtime and it isn't possible for me to modify it then what's the best way to check and report an error if it does contain any other values ? Do I need to examine each and every element against values of 1 and 2 to make sure no other values are contained in the list. </p>
