/[classpath]/classpath/java/util/LinkedList.java
ViewVC logotype

Diff of /classpath/java/util/LinkedList.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by ericb, Mon Oct 22 03:46:07 2001 UTC revision 1.15 by ericb, Mon Oct 22 05:48:01 2001 UTC
# Line 176  public class LinkedList extends Abstract Line 176  public class LinkedList extends Abstract
176     * @param index the index to check     * @param index the index to check
177     * @throws IndexOutOfBoundsException if index < 0 || index > size     * @throws IndexOutOfBoundsException if index < 0 || index > size
178     */     */
179    private void rangeInclusive(int index)    private void checkBoundsInclusive(int index)
180    {    {
181      if (index < 0 || index > size)      if (index < 0 || index > size)
182        throw new IndexOutOfBoundsException("Index: " + index + ", Size:"        throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
# Line 189  public class LinkedList extends Abstract Line 189  public class LinkedList extends Abstract
189     * @param index the index to check     * @param index the index to check
190     * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size     * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size
191     */     */
192    private void rangeExclusive(int index)    private void checkBoundsExclusive(int index)
193    {    {
194      if (index < 0 || index >= size)      if (index < 0 || index >= size)
195        throw new IndexOutOfBoundsException("Index: " + index + ", Size:"        throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
# Line 428  public class LinkedList extends Abstract Line 428  public class LinkedList extends Abstract
428     */     */
429    public boolean addAll(int index, Collection c)    public boolean addAll(int index, Collection c)
430    {    {
431      rangeInclusive(index);      checkBoundsInclusive(index);
432      int csize = c.size();      int csize = c.size();
433    
434      if (csize == 0)      if (csize == 0)
# Line 506  public class LinkedList extends Abstract Line 506  public class LinkedList extends Abstract
506     */     */
507    public Object get(int index)    public Object get(int index)
508    {    {
509      rangeExclusive(index);      checkBoundsExclusive(index);
510      return getEntry(index).data;      return getEntry(index).data;
511    }    }
512    
# Line 520  public class LinkedList extends Abstract Line 520  public class LinkedList extends Abstract
520     */     */
521    public Object set(int index, Object o)    public Object set(int index, Object o)
522    {    {
523      rangeExclusive(index);      checkBoundsExclusive(index);
524      Entry e = getEntry(index);      Entry e = getEntry(index);
525      Object old = e.data;      Object old = e.data;
526      e.data = o;      e.data = o;
# Line 536  public class LinkedList extends Abstract Line 536  public class LinkedList extends Abstract
536     */     */
537    public void add(int index, Object o)    public void add(int index, Object o)
538    {    {
539      rangeInclusive(index);      checkBoundsInclusive(index);
540      Entry e = new Entry(o);      Entry e = new Entry(o);
541    
542      if (index < size)      if (index < size)
# Line 565  public class LinkedList extends Abstract Line 565  public class LinkedList extends Abstract
565     */     */
566    public Object remove(int index)    public Object remove(int index)
567    {    {
568      rangeExclusive(index);      checkBoundsExclusive(index);
569      Entry e = getEntry(index);      Entry e = getEntry(index);
570      removeEntry(e);      removeEntry(e);
571      return e.data;      return e.data;
# Line 622  public class LinkedList extends Abstract Line 622  public class LinkedList extends Abstract
622     */     */
623    public ListIterator listIterator(int index)    public ListIterator listIterator(int index)
624    {    {
625      rangeInclusive(index);      checkBoundsInclusive(index);
626      return new LinkedListItr(index);      return new LinkedListItr(index);
627    }    }
628    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26