//----------------------------------------------------------------------- public override bool Equals(Object obj) { if (obj == this) { return(true); } if (obj is java.util.List <Object> == false) { return(false); } java.util.List <Object> other = (java.util.List <Object>)obj; if (other.size() != size()) { return(false); } java.util.ListIterator <Object> it1 = listIterator(); java.util.ListIterator <Object> it2 = other.listIterator(); while (it1.hasNext() && it2.hasNext()) { Object o1 = it1.next(); Object o2 = it2.next(); if (!(o1 == null ? o2 == null : o1.equals(o2))) { return(false); } } return(!(it1.hasNext() || it2.hasNext())); }
public SubListIter(int i, SubList root) { this.rootSubList = root; this.root = root.root; this.expected = this.root.list; this.iter = rootSubList.get(expected).listIterator(i); }
internal SubAbstractListIterator(java.util.ListIterator <E> it, java.util.AbstractList .SubAbstractList <E> list, int offset, int length) { iterator = it; subList = list; start = offset; end = start + length; }
//----------------------------------------------------------------------- /** * Constructor that decorates the specified iterator. * * @param iterator the iterator to decorate, must not be null * @throws IllegalArgumentException if the collection is null */ public AbstractListIteratorDecorator(java.util.ListIterator <Object> iterator) : base() { if (iterator == null) { throw new java.lang.IllegalArgumentException("ListIterator must not be null"); } this.iterator = iterator; }
public void add(Object o) { checkMod(); int i = nextIndex(); get().add(i, o); expected = root.list; iter = get().listIterator(i + 1); lastReturnedIndex = -1; }
public void set(Object o) { checkMod(); if (lastReturnedIndex < 0) { throw new java.lang.IllegalStateException(); } get().set(lastReturnedIndex, o); expected = root.list; iter = get().listIterator(previousIndex() + 1); }
public override E set(int location, E @object) { java.util.ListIterator <E> it = listIterator(location); if (!it.hasNext()) { throw new System.IndexOutOfRangeException(); } E result = it.next(); it.set(@object); return(result); }
//----------------------------------------------------------------------- /** * Decorates the specified iterator such that it cannot be modified. * * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ public static java.util.ListIterator <Object> decorate(java.util.ListIterator <Object> iterator) { if (iterator == null) { throw new java.lang.IllegalArgumentException("ListIterator must not be null"); } if (iterator is Unmodifiable) { return(iterator); } return(new UnmodifiableListIterator(iterator)); }
public void remove() { checkMod(); if (lastReturnedIndex < 0) { throw new java.lang.IllegalStateException(); } get().remove(lastReturnedIndex); expected = root.list; iter = get().listIterator(lastReturnedIndex); lastReturnedIndex = -1; }
/** * Gets a list iterator that filters another list iterator. * <p> * The returned iterator will only return objects that match the specified * filtering predicate. * * @param listIterator the list iterator to use, not null * @param predicate the predicate to use as a filter, not null * @return a new filtered iterator * @throws NullPointerException if either parameter is null */ public static java.util.ListIterator <Object> filteredListIterator(java.util.ListIterator <Object> listIterator, Predicate predicate) { if (listIterator == null) { throw new java.lang.NullPointerException("ListIterator must not be null"); } if (predicate == null) { throw new java.lang.NullPointerException("Predicate must not be null"); } return(new FilterListIterator(listIterator, predicate)); }
public override bool addAll <_T0>(int location, java.util.Collection <_T0> collection ) { java.util.ListIterator <E> it = listIterator(location); java.util.Iterator <_T0> colIt = collection.iterator(); int next = it.nextIndex(); while (colIt.hasNext()) { it.add(colIt.next()); } return(next != it.nextIndex()); }
public override E remove(int location) { try { java.util.ListIterator <E> it = listIterator(location); E result = it.next(); it.remove(); return(result); } catch (java.util.NoSuchElementException) { throw new System.IndexOutOfRangeException(); } }
/** * Compare the specified object with this list for equality. This * implementation uses exactly the code that is used to define the * list equals function in the documentation for the * <code>List.equals</code> method. * * @param o Object to be compared to this list */ public override bool Equals(Object o) { // Simple tests that require no synchronization if (o == this) { return(true); } else if (!(o is java.util.List <Object>)) { return(false); } java.util.List <Object> lo = (java.util.List <Object>)o; // Compare the sets of elements for equality if (fast) { java.util.ListIterator <Object> li1 = list.listIterator(); java.util.ListIterator <Object> li2 = lo.listIterator(); while (li1.hasNext() && li2.hasNext()) { Object o1 = li1.next(); Object o2 = li2.next(); if (!(o1 == null ? o2 == null : o1.equals(o2))) { return(false); } } return(!(li1.hasNext() || li2.hasNext())); } else { lock (list) { java.util.ListIterator <Object> li1 = list.listIterator(); java.util.ListIterator <Object> li2 = lo.listIterator(); while (li1.hasNext() && li2.hasNext()) { Object o1 = li1.next(); Object o2 = li2.next(); if (!(o1 == null ? o2 == null : o1.equals(o2))) { return(false); } } return(!(li1.hasNext() || li2.hasNext())); } } }
private int runLimit(java.util.List <IAC_Range> ranges) { int result = end; java.util.ListIterator <IAC_Range> it = ranges.listIterator(ranges.size()); while (it.hasPrevious()) { IAC_Range range = it.previous(); if (range.end <= begin) { break; } if (offset >= range.start && offset < range.end) { return(inRange(range) ? range.end : result); } else if (offset >= range.end) { break; } result = range.start; } return(result); }
/** * Constructor. * @param parent the parent map */ protected internal BidiOrderedMapIterator(AbstractDualBidiMap parent) : base() { this.parent = parent; iterator = new java.util.ArrayList<Object>((java.util.Collection<Object>)parent.entrySet()).listIterator(); }
public virtual void reset() { iterator = new java.util.ArrayList<Object>((java.util.Collection<Object>)parent.entrySet()).listIterator(); last = null; }
/** * Constructor that wraps a list. * * @param list the list to create a reversed iterator for * @throws NullPointerException if the list is null */ public ReverseListIterator(java.util.List<Object> list) : base() { this.list = list; iterator = list.listIterator(list.size()); }
protected internal PredicatedListIterator(java.util.ListIterator <Object> iterator, PredicatedList root) : base(iterator) { this.root = root; }
/** * Applies a given attribute to the given range of this string. * * @param attribute * the attribute that will be applied to this string. * @param value * the value of the attribute that will be applied to this * string. * @param start * the start of the range where the attribute will be applied. * @param end * the end of the range where the attribute will be applied. * @throws IllegalArgumentException * if {@code start < 0}, {@code end} is greater than the length * of this string, or if {@code start >= end}. * @throws NullPointerException * if {@code attribute} is {@code null}. */ public void addAttribute(AttributedCharacterIteratorNS.Attribute attribute, System.Object value, int start, int end) { if (null == attribute) { throw new java.lang.NullPointerException(); } if (start < 0 || end > text.Length || start >= end) { throw new java.lang.IllegalArgumentException(); } if (value == null) { return; } java.util.List <IAC_Range> ranges = attributeMap.get(attribute); if (ranges == null) { ranges = new java.util.ArrayList <IAC_Range>(1); ranges.add(new IAC_Range(start, end, value)); attributeMap.put(attribute, ranges); return; } java.util.ListIterator <IAC_Range> it = ranges.listIterator(); while (it.hasNext()) { IAC_Range range = it.next(); if (end <= range.start) { it.previous(); break; } else if (start < range.end || (start == range.end && value.Equals(range.value))) { IAC_Range r1 = null, r3; it.remove(); r1 = new IAC_Range(range.start, start, range.value); r3 = new IAC_Range(end, range.end, range.value); while (end > range.end && it.hasNext()) { range = it.next(); if (end <= range.end) { if (end > range.start || (end == range.start && value.Equals(range.value))) { it.remove(); r3 = new IAC_Range(end, range.end, range.value); break; } } else { it.remove(); } } if (value.Equals(r1.value)) { if (value.Equals(r3.value)) { it.add(new IAC_Range(r1.start <start?r1.start : start, r3.end> end ? r3.end : end, r1.value)); } else { it.add(new IAC_Range(r1.start < start ? r1.start : start, end, r1.value)); if (r3.start < r3.end) { it.add(r3); } } } else { if (value.Equals(r3.value)) { if (r1.start < r1.end) { it.add(r1); } it.add(new IAC_Range(start, r3.end > end ? r3.end : end, r3.value)); } else { if (r1.start < r1.end) { it.add(r1); } it.add(new IAC_Range(start, end, value)); if (r3.start < r3.end) { it.add(r3); } } } return; } } it.add(new IAC_Range(start, end, value)); }
protected internal FixedSizeListIterator(java.util.ListIterator <Object> iterator) : base(iterator) { }
//----------------------------------------------------------------------- /** * Constructor. * * @param iterator the iterator to decorate */ private UnmodifiableListIterator(java.util.ListIterator <Object> iterator) : base() { this.iterator = iterator; }
protected internal SetListListIterator(java.util.ListIterator <Object> it, java.util.Set <Object> set) : base(it) { this.setJ = set; }
/** * Constructor that wraps a list. * * @param list the list to create a reversed iterator for * @throws NullPointerException if the list is null */ public ReverseListIterator(java.util.List <Object> list) : base() { this.list = list; iterator = list.listIterator(list.size()); }
/** * Resets the iterator back to the start (which is the * end of the list as this is a reversed iterator) */ public void reset() { iterator = list.listIterator(list.size()); }
/** * Setter for property iterator. * @param iterator New value of property iterator. */ public void setListIterator(java.util.ListIterator <Object> iterator) { this.iterator = iterator; }
/** * Constructs a new <code>FilterListIterator</code>. * * @param iterator the iterator to use * @param predicate the predicate to use */ public FilterListIterator(java.util.ListIterator <Object> iterator, Predicate predicate) : base() { this.iterator = iterator; this.predicate = predicate; }
/** * Constructs a new <code>ProxyListIterator</code> that will use the * given list iterator. * * @param iterator the list iterator to use */ public ProxyListIterator(java.util.ListIterator <Object> iterator) { this.iterator = iterator; }
/** * Gets an immutable version of a {@link ListIterator}. The returned object * will always throw an {@link UnsupportedOperationException} for * the {@link Iterator#remove}, {@link ListIterator#add} and * {@link ListIterator#set} methods. * * @param listIterator the iterator to make immutable * @return an immutable version of the iterator */ public static java.util.ListIterator <Object> unmodifiableListIterator(java.util.ListIterator <Object> listIterator) { return(UnmodifiableListIterator.decorate(listIterator)); }
/** * Constructor. * @param parent the parent map */ protected internal BidiOrderedMapIterator(AbstractDualBidiMap parent) : base() { this.parent = parent; iterator = new java.util.ArrayList <Object>((java.util.Collection <Object>)parent.entrySet()).listIterator(); }
public ListIter(int i, FastArrayList root) { this.root = root; this.expected = root.list; this.iter = get().listIterator(i); }
public virtual void reset() { iterator = new java.util.ArrayList <Object>((java.util.Collection <Object>)parent.entrySet()).listIterator(); last = null; }
/** * Resets the iterator back to the start of the list. */ public void reset() { iterator = list.listIterator(); }
/** * Constructs a new <code>FilterListIterator</code> that will not * function until {@link #setPredicate(Predicate) setPredicate} is invoked. * * @param iterator the iterator to use */ public FilterListIterator(java.util.ListIterator <Object> iterator) : base() { this.iterator = iterator; }