diff options
| author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-03 03:58:05 +0000 |
|---|---|---|
| committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-03 03:58:05 +0000 |
| commit | 8856e75045a99a9510faa152d0dbe3ec5c0df68d (patch) | |
| tree | 513ddc423b9316dfe96f3d5e79a6ca4749279337 /libjava/java/util/LinkedList.java | |
| parent | 87deb99cbc4f3ac8a6807279a646356a4f368a27 (diff) | |
| download | gcc-8856e75045a99a9510faa152d0dbe3ec5c0df68d.tar.gz | |
2000-11-03 Bryce McKinlay <bryce@albatross.co.nz>
* java/util/AbstractList.java (SubList): Make it a top-level private
class.
* java/util/LinkedList.java (remove): Do update modCount and
knownMod.
(add): Ditto.
* Makefile.am (ordinary_java_source_files): Add LinkedList.java.
* Makefile.in: Rebuilt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37218 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/LinkedList.java')
| -rw-r--r-- | libjava/java/util/LinkedList.java | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/libjava/java/util/LinkedList.java b/libjava/java/util/LinkedList.java index 5854496708e..22219294479 100644 --- a/libjava/java/util/LinkedList.java +++ b/libjava/java/util/LinkedList.java @@ -322,7 +322,7 @@ public class LinkedList extends AbstractSequentialList prev.next = e; prev = e; } - // Fix up the links between the last new entry and the following entry. + // Link the new chain of entries into the list. prev.next = after; if (after != null) after.previous = e; @@ -541,7 +541,7 @@ public class LinkedList extends AbstractSequentialList * position, in a list of given size. */ LinkedListItr(int index) - { + { if (index == size) { next = null; @@ -621,8 +621,8 @@ public class LinkedList extends AbstractSequentialList next = lastReturned.next; previous = lastReturned.previous; - // Because the list is being manipulated directly, there's no need to - // touch either modCount or knownMod here. + modCount++; + knownMod++; removeEntry(lastReturned); lastReturned = null; @@ -631,11 +631,27 @@ public class LinkedList extends AbstractSequentialList public void add(Object o) { checkMod(); - // Because the list is being manipulated directly, there's no need to - // touch either modCount or knownMod here. + modCount++; + knownMod++; Entry e = new Entry(o); - addEntry(position, e); + e.previous = previous; + e.next = next; + + if (previous != null) + previous.next = e; + else + first = e; + + if (next != null) + { + next.previous = e; + next = next.next; + } + else + last = e; + previous = e; + size++; position++; lastReturned = null; } |
