diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-05-18 14:03:42 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-05-18 14:03:42 -0700 |
commit | b30ccc77d3a9822c6ffcebf9b45945822df200bc (patch) | |
tree | 94105ea42fa81ad0b8731b05a46c7f64304dec55 /java/src/Freeze/LinkedList.java | |
parent | Removed Freeze.UseNonmutating (diff) | |
download | ice-b30ccc77d3a9822c6ffcebf9b45945822df200bc.tar.bz2 ice-b30ccc77d3a9822c6ffcebf9b45945822df200bc.tar.xz ice-b30ccc77d3a9822c6ffcebf9b45945822df200bc.zip |
bug 252 - Freeze finalizers
bug 2552 - Update Freeze for Java5
Diffstat (limited to 'java/src/Freeze/LinkedList.java')
-rw-r--r-- | java/src/Freeze/LinkedList.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/java/src/Freeze/LinkedList.java b/java/src/Freeze/LinkedList.java index c4457255527..36ef4e8cb50 100644 --- a/java/src/Freeze/LinkedList.java +++ b/java/src/Freeze/LinkedList.java @@ -20,7 +20,7 @@ package Freeze; // retained over structural changes to the list itself (similar to an // STL list). // -public class LinkedList +public class LinkedList<T> { public LinkedList() @@ -28,7 +28,7 @@ public class LinkedList _header.next = _header.previous = _header; } - public java.lang.Object + public T getFirst() { if(_size == 0) @@ -39,7 +39,7 @@ public class LinkedList return _header.next.element; } - public java.lang.Object + public T getLast() { if(_size == 0) @@ -51,11 +51,11 @@ public class LinkedList } public void - addFirst(java.lang.Object o) + addFirst(T o) { addBefore(o, _header.next); } - + public boolean isEmpty() { @@ -68,19 +68,19 @@ public class LinkedList return _size; } - public java.util.Iterator + public java.util.Iterator<T> iterator() { return new ForwardIterator(); } - public java.util.Iterator + public java.util.Iterator<T> riterator() { return new ReverseIterator(); } - private class ForwardIterator implements java.util.Iterator + private class ForwardIterator implements java.util.Iterator<T> { public boolean hasNext() @@ -88,7 +88,7 @@ public class LinkedList return _next != null; } - public java.lang.Object + public T next() { if(_next == null) @@ -133,11 +133,11 @@ public class LinkedList _current = null; } - private Entry _current; - private Entry _next; + private Entry<T> _current; + private Entry<T> _next; } - private class ReverseIterator implements java.util.Iterator + private class ReverseIterator implements java.util.Iterator<T> { public boolean hasNext() @@ -145,7 +145,7 @@ public class LinkedList return _next != null; } - public java.lang.Object + public T next() { if(_next == null) @@ -190,17 +190,17 @@ public class LinkedList _current = null; } - private Entry _current; - private Entry _next; + private Entry<T> _current; + private Entry<T> _next; } - private static class Entry + private static class Entry<T> { - java.lang.Object element; - Entry next; - Entry previous; + T element; + Entry<T> next; + Entry<T> previous; - Entry(java.lang.Object element, Entry next, Entry previous) + Entry(T element, Entry<T> next, Entry<T> previous) { this.element = element; this.next = next; @@ -208,10 +208,10 @@ public class LinkedList } } - private Entry - addBefore(java.lang.Object o, Entry e) + private Entry<T> + addBefore(T o, Entry<T> e) { - Entry newEntry = new Entry(o, e, e.previous); + Entry<T> newEntry = new Entry<T>(o, e, e.previous); newEntry.previous.next = newEntry; newEntry.next.previous = newEntry; _size++; @@ -219,7 +219,7 @@ public class LinkedList } private void - remove(Entry e) + remove(Entry<T> e) { if(e == _header) { @@ -231,6 +231,6 @@ public class LinkedList _size--; } - private Entry _header = new Entry(null, null, null); + private Entry<T> _header = new Entry<T>(null, null, null); private int _size = 0; } |