How do I throw and UnsupportedOperationException on a method? So if I have an Iterable object and I'm trying to disallow the remove method for that object.
In the method below I'm returning an iterable object whose iterator's remove I need to disable by throwing an UnsupportedErrorException. Can I do this within the body of the method or how so?
public Iterable<String> getInNodes (String destinationNodeName) { if (!hasNode(destinationNodeName)) return emptySetOfString; else { for(String e : nodeMap.get(destinationNodeName).inNodes) { emptySetOfString.add(e); } return emptySetOfString; } }
throw new UnsupportedOperationException()?