public int size() { checkForComod(); return super.size(); }
public int size() { checkForComod(); return super.size(); }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
CursorableSubList(CursorableLinkedList list, int from, int to) { if(0 > from || list.size() < to) { throw new IndexOutOfBoundsException(); } else if(from > to) { throw new IllegalArgumentException(); } _list = list; if(from < list.size()) { _head.setNext(_list.getListableAt(from)); _pre = (null == _head.next()) ? null : _head.next().prev(); } else { _pre = _list.getListableAt(from-1); } if(from == to) { _head.setNext(null); _head.setPrev(null); if(to < list.size()) { _post = _list.getListableAt(to); } else { _post = null; } } else { _head.setPrev(_list.getListableAt(to-1)); _post = _head.prev().next(); } _size = to - from; _modCount = _list._modCount; }
CursorableSubList(CursorableLinkedList list, int from, int to) { if(0 > from || list.size() < to) { throw new IndexOutOfBoundsException(); } else if(from > to) { throw new IllegalArgumentException(); } _list = list; if(from < list.size()) { _head.setNext(_list.getListableAt(from)); _pre = (null == _head.next()) ? null : _head.next().prev(); } else { _pre = _list.getListableAt(from-1); } if(from == to) { _head.setNext(null); _head.setPrev(null); if(to < list.size()) { _post = _list.getListableAt(to); } else { _post = null; } } else { _head.setPrev(_list.getListableAt(to-1)); _post = _head.prev().next(); } _size = to - from; _modCount = _list._modCount; }
public void testClear() { assertEquals(0,list.size()); assertTrue(list.isEmpty()); list.clear(); assertEquals(0,list.size()); assertTrue(list.isEmpty()); list.add("element"); assertEquals(1,list.size()); assertTrue(!list.isEmpty()); list.clear(); assertEquals(0,list.size()); assertTrue(list.isEmpty()); list.add("element1"); list.add("element2"); assertEquals(2,list.size()); assertTrue(!list.isEmpty()); list.clear(); assertEquals(0,list.size()); assertTrue(list.isEmpty()); for(int i=0;i<1000;i++) { list.add(new Integer(i)); } assertEquals(1000,list.size()); assertTrue(!list.isEmpty()); list.clear(); assertEquals(0,list.size()); assertTrue(list.isEmpty()); }
public int size() { checkForComod(); return super.size(); }
public int size() { checkForComod(); return super.size(); }
public int size() { checkForComod(); return super.size(); }
public int size() { checkForComod(); return super.size(); }
public int size() { checkForComod(); return super.size(); }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
public int nextIndex() { checkForComod(); if(!hasNext()) { return size(); } return _nextIndex; }
CursorableSubList(CursorableLinkedList list, int from, int to) { if(0 > from || list.size() < to) { throw new IndexOutOfBoundsException(); } else if(from > to) { throw new IllegalArgumentException(); } _list = list; if(from < list.size()) { _head.setNext(_list.getListableAt(from)); _pre = (null == _head.next()) ? null : _head.next().prev(); } else { _pre = _list.getListableAt(from-1); } if(from == to) { _head.setNext(null); _head.setPrev(null); if(to < list.size()) { _post = _list.getListableAt(to); } else { _post = null; } } else { _head.setPrev(_list.getListableAt(to-1)); _post = _head.prev().next(); } _size = to - from; _modCount = _list._modCount; }
CursorableSubList(CursorableLinkedList list, int from, int to) { if(0 > from || list.size() < to) { throw new IndexOutOfBoundsException(); } else if(from > to) { throw new IllegalArgumentException(); } _list = list; if(from < list.size()) { _head.setNext(_list.getListableAt(from)); _pre = (null == _head.next()) ? null : _head.next().prev(); } else { _pre = _list.getListableAt(from-1); } if(from == to) { _head.setNext(null); _head.setPrev(null); if(to < list.size()) { _post = _list.getListableAt(to); } else { _post = null; } } else { _head.setPrev(_list.getListableAt(to-1)); _post = _head.prev().next(); } _size = to - from; _modCount = _list._modCount; }
CursorableSubList(CursorableLinkedList list, int from, int to) { if(0 > from || list.size() < to) { throw new IndexOutOfBoundsException(); } else if(from > to) { throw new IllegalArgumentException(); } _list = list; if(from < list.size()) { _head.setNext(_list.getListableAt(from)); _pre = (null == _head.next()) ? null : _head.next().prev(); } else { _pre = _list.getListableAt(from-1); } if(from == to) { _head.setNext(null); _head.setPrev(null); if(to < list.size()) { _post = _list.getListableAt(to); } else { _post = null; } } else { _head.setPrev(_list.getListableAt(to-1)); _post = _head.prev().next(); } _size = to - from; _modCount = _list._modCount; }