error message
i get the following error message when i try to compile:
"removeRange(int,int) has protected access in java.util.ArrayList
and higlights:
drinks.removeRange(9, 19);
what im trying to do is remove certain items, at specific positions in the ArrayList drinks
any ideas how to solve this?
thnx chias
[339 byte] By [
chiasa] at [2007-11-27 4:04:13]

If you insist on using the removeRange method, you would have to subclass ArrayList. About why removeRange is protected, see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4230617As an alternative, you could use the remove method in a for loop.Tobias
Use the subList method.
[url http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractList.html#subList(int, int)]http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractList.html#subList(int, int)[/url]
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by operating on a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:list.subList(from, to).clear();