public boolean equals(Object obj) { if (obj == null) { return _size() <= start; } if (obj instanceof AMList) { AMList o = (AMList) obj; int cnt = _size(); if (cnt - start != o._size() - o.start) { return false; } Object[] arr = array(), arr_ = o.array(); for (int i = start, j = o.start; i < cnt; ++i, ++j) { Object a = arr[i], b = arr_[j]; if (a != b && (a == null || !a.equals(b))) { return false; } } return true; } if (!(obj instanceof AList)) { return false; } Object[] array = array(); AIter j = (AList) obj; Object x, y; for (int cnt = _size(), i = start; i < cnt; ++i) { if (j == null || (x = array[i]) != (y = j.first()) && (x == null || !x.equals(y))) { return false; } j = j.next(); } return j == null; }
public MList(AIter iter) { if (iter == null || iter.isEmpty()) { array = EMPTY; } else { array = new Object[10]; while (iter != null) { add(iter.first()); iter = iter.next(); } } }