You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2005/12/01 07:04:00 UTC

svn commit: r350181 [119/198] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core: ./ depends/ depends/files/ depends/jars/ depends/libs/ depends/libs/linux.IA32/ depends/libs/win.IA32/ depends/oss/ depends/oss/linux.IA32/ depends/oss/win....

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/LinkedList.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/LinkedList.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/LinkedList.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/LinkedList.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,725 @@
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+
+/**
+ * LinkedList is an implementation of List, backed by a linked list. All
+ * optional operations are supported, adding, removing and replacing. The
+ * elements can be any objects.
+ */
+public class LinkedList extends AbstractSequentialList implements List,
+		Cloneable, Serializable {
+	
+	static final long serialVersionUID = 876323262645176354L;
+
+	transient int size = 0;
+
+	transient Link voidLink;
+
+	private static final class Link {
+		Object data;
+
+		Link previous, next;
+
+		Link(Object o, Link p, Link n) {
+			data = o;
+			previous = p;
+			next = n;
+		}
+	}
+
+	private static final class LinkIterator implements ListIterator {
+		int pos, expectedModCount;
+
+		LinkedList list;
+
+		Link link, lastLink;
+
+		LinkIterator(LinkedList object, int location) {
+			list = object;
+			expectedModCount = list.modCount;
+			if (0 <= location && location <= list.size) {
+				// pos ends up as -1 if list is empty, it ranges from -1 to
+				// list.size - 1
+				// if link == voidLink then pos must == -1
+				link = list.voidLink;
+				if (location < list.size / 2) {
+					for (pos = -1; pos + 1 < location; pos++)
+						link = link.next;
+				} else {
+					for (pos = list.size; pos >= location; pos--)
+						link = link.previous;
+				}
+			} else
+				throw new IndexOutOfBoundsException();
+		}
+
+		public void add(Object object) {
+			if (expectedModCount == list.modCount) {
+				Link next = link.next;
+				Link newLink = new Link(object, link, next);
+				link.next = newLink;
+				next.previous = newLink;
+				link = newLink;
+				lastLink = null;
+				pos++;
+				expectedModCount++;
+				list.size++;
+				list.modCount++;
+			} else
+				throw new ConcurrentModificationException();
+		}
+
+		public boolean hasNext() {
+			return link.next != list.voidLink;
+		}
+
+		public boolean hasPrevious() {
+			return link != list.voidLink;
+		}
+
+		public Object next() {
+			if (expectedModCount == list.modCount) {
+				LinkedList.Link next = link.next;
+				if (next != list.voidLink) {
+					lastLink = link = next;
+					pos++;
+					return link.data;
+				} else
+					throw new NoSuchElementException();
+			} else
+				throw new ConcurrentModificationException();
+		}
+
+		public int nextIndex() {
+			return pos + 1;
+		}
+
+		public Object previous() {
+			if (expectedModCount == list.modCount) {
+				if (link != list.voidLink) {
+					lastLink = link;
+					link = link.previous;
+					pos--;
+					return lastLink.data;
+				} else
+					throw new NoSuchElementException();
+			} else
+				throw new ConcurrentModificationException();
+		}
+
+		public int previousIndex() {
+			return pos;
+		}
+
+		public void remove() {
+			if (expectedModCount == list.modCount) {
+				if (lastLink != null) {
+					Link next = lastLink.next;
+					Link previous = lastLink.previous;
+					next.previous = previous;
+					previous.next = next;
+					if (lastLink == link)
+						pos--;
+					link = previous;
+					lastLink = null;
+					expectedModCount++;
+					list.size--;
+					list.modCount++;
+				} else
+					throw new IllegalStateException();
+			} else
+				throw new ConcurrentModificationException();
+		}
+
+		public void set(Object object) {
+			if (expectedModCount == list.modCount) {
+				if (lastLink != null)
+					lastLink.data = object;
+				else
+					throw new IllegalStateException();
+			} else
+				throw new ConcurrentModificationException();
+		}
+	}
+
+	/**
+	 * Contructs a new empty instance of LinkedList.
+	 * 
+	 */
+	public LinkedList() {
+		voidLink = new Link(null, null, null);
+		voidLink.previous = voidLink;
+		voidLink.next = voidLink;
+	}
+
+	/**
+	 * Constructs a new instance of <code>LinkedList</code> that holds 
+	 * all of the elements contained in the supplied <code>collection</code>
+	 * argument. The order of the elements in this new <code>LinkedList</code> 
+	 * will be determined by the iteration order of <code>collection</code>. 
+	 * 
+	 * @param collection
+	 *            the collection of elements to add
+	 */
+	public LinkedList(Collection collection) {
+		this();
+		addAll(collection);
+	}
+
+	/**
+	 * Inserts the specified object into this LinkedList at the specified
+	 * location. The object is inserted before any previous element at the
+	 * specified location. If the location is equal to the size of this
+	 * LinkedList, the object is added at the end.
+	 * 
+	 * @param location
+	 *            the index at which to insert
+	 * @param object
+	 *            the object to add
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public void add(int location, Object object) {
+		if (0 <= location && location <= size) {
+			Link link = voidLink;
+			if (location < (size / 2)) {
+				for (int i = 0; i <= location; i++)
+					link = link.next;
+			} else {
+				for (int i = size; i > location; i--)
+					link = link.previous;
+			}
+			Link previous = link.previous;
+			Link newLink = new Link(object, previous, link);
+			previous.next = newLink;
+			link.previous = newLink;
+			size++;
+			modCount++;
+		} else
+			throw new IndexOutOfBoundsException();
+	}
+
+	/**
+	 * Adds the specified object at the end of this LinkedList.
+	 * 
+	 * @param object
+	 *            the object to add
+	 * @return true
+	 */
+	public boolean add(Object object) {
+		// Cannot call addLast() as sublasses can override
+		Link oldLast = voidLink.previous;
+		Link newLink = new Link(object, oldLast, voidLink);
+		voidLink.previous = newLink;
+		oldLast.next = newLink;
+		size++;
+		modCount++;
+		return true;
+	}
+
+	/**
+	 * Inserts the objects in the specified Collection at the specified location
+	 * in this LinkedList. The objects are added in the order they are returned
+	 * from the <code>Collection</code> iterator.
+	 * 
+	 * @param location
+	 *            the index at which to insert
+	 * @param collection
+	 *            the Collection of objects
+	 * @return true if this LinkedList is modified, false otherwise
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public boolean addAll(int location, Collection collection) {
+		int adding = collection.size();
+		if (adding == 0)
+			return false;
+		if (0 <= location && location <= size) {
+			Link previous = voidLink;
+			if (location < (size / 2)) {
+				for (int i = 0; i < location; i++)
+					previous = previous.next;
+			} else {
+				for (int i = size; i >= location; i--)
+					previous = previous.previous;
+			}
+			Link next = previous.next;
+
+			Iterator it = collection.iterator();
+			while (it.hasNext()) {
+				Link newLink = new Link(it.next(), previous, null);
+				previous.next = newLink;
+				previous = newLink;
+			}
+			previous.next = next;
+			next.previous = previous;
+			size += adding;
+			modCount++;
+			return true;
+		} else
+			throw new IndexOutOfBoundsException();
+	}
+
+	/**
+	 * Adds the objects in the specified Collection to this LinkedList.
+	 * 
+	 * @param collection
+	 *            the Collection of objects
+	 * @return true if this LinkedList is modified, false otherwise
+	 */
+	public boolean addAll(Collection collection) {
+		int adding = collection.size();
+		if (adding == 0)
+			return false;
+		Link previous = voidLink.previous;
+		Iterator it = collection.iterator();
+		while (it.hasNext()) {
+			Link newLink = new Link(it.next(), previous, null);
+			previous.next = newLink;
+			previous = newLink;
+		}
+		previous.next = voidLink;
+		voidLink.previous = previous;
+		size += adding;
+		modCount++;
+		return true;
+	}
+
+	/**
+	 * Adds the specified object at the begining of this LinkedList.
+	 * 
+	 * @param object
+	 *            the object to add
+	 */
+	public void addFirst(Object object) {
+		Link oldFirst = voidLink.next;
+		Link newLink = new Link(object, voidLink, oldFirst);
+		voidLink.next = newLink;
+		oldFirst.previous = newLink;
+		size++;
+		modCount++;
+	}
+
+	/**
+	 * Adds the specified object at the end of this LinkedList.
+	 * 
+	 * @param object
+	 *            the object to add
+	 */
+	public void addLast(Object object) {
+		Link oldLast = voidLink.previous;
+		Link newLink = new Link(object, oldLast, voidLink);
+		voidLink.previous = newLink;
+		oldLast.next = newLink;
+		size++;
+		modCount++;
+	}
+
+	/**
+	 * Removes all elements from this LinkedList, leaving it empty.
+	 * 
+	 * @see List#isEmpty
+	 * @see #size
+	 */
+	public void clear() {
+		if (size > 0) {
+			size = 0;
+			voidLink.next = voidLink;
+			voidLink.previous = voidLink;
+			modCount++;
+		}
+	}
+
+	/**
+	 * Answers a new LinkedList with the same elements and size as this
+	 * LinkedList.
+	 * 
+	 * @return a shallow copy of this LinkedList
+	 * 
+	 * @see java.lang.Cloneable
+	 */
+	public Object clone() {
+		return new LinkedList(this);
+	}
+
+	/**
+	 * Searches this LinkedList for the specified object.
+	 * 
+	 * @param object
+	 *            the object to search for
+	 * @return true if <code>object</code> is an element of this LinkedList,
+	 *         false otherwise
+	 */
+	public boolean contains(Object object) {
+		Link link = voidLink.next;
+		if (object != null) {
+			while (link != voidLink) {
+				if (object.equals(link.data))
+					return true;
+				link = link.next;
+			}
+		} else {
+			while (link != voidLink) {
+				if (link.data == null)
+					return true;
+				link = link.next;
+			}
+		}
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.List#get(int)
+	 */
+	public Object get(int location) {
+		if (0 <= location && location < size) {
+			Link link = voidLink;
+			if (location < (size / 2)) {
+				for (int i = 0; i <= location; i++)
+					link = link.next;
+			} else {
+				for (int i = size; i > location; i--)
+					link = link.previous;
+			}
+			return link.data;
+		} else
+			throw new IndexOutOfBoundsException();
+	}
+
+	/**
+	 * Answers the first element in this LinkedList.
+	 * 
+	 * @return the first element
+	 * 
+	 * @exception NoSuchElementException
+	 *                when this LinkedList is empty
+	 */
+	public Object getFirst() {
+		Link first = voidLink.next;
+		if (first != voidLink)
+			return first.data;
+		throw new NoSuchElementException();
+	}
+
+	/**
+	 * Answers the last element in this LinkedList.
+	 * 
+	 * @return the last element
+	 * 
+	 * @exception NoSuchElementException
+	 *                when this LinkedList is empty
+	 */
+	public Object getLast() {
+		Link last = voidLink.previous;
+		if (last != voidLink)
+			return last.data;
+		throw new NoSuchElementException();
+	}
+
+	/**
+	 * Searches this LinkedList for the specified object and returns the index
+	 * of the first occurrence.
+	 * 
+	 * @param object
+	 *            the object to search for
+	 * @return the index of the first occurrence of the object
+	 */
+	public int indexOf(Object object) {
+		int pos = 0;
+		Link link = voidLink.next;
+		if (object != null) {
+			while (link != voidLink) {
+				if (object.equals(link.data))
+					return pos;
+				link = link.next;
+				pos++;
+			}
+		} else {
+			while (link != voidLink) {
+				if (link.data == null)
+					return pos;
+				link = link.next;
+				pos++;
+			}
+		}
+		return -1;
+	}
+
+	/**
+	 * Searches this LinkedList for the specified object and returns the index
+	 * of the last occurrence.
+	 * 
+	 * @param object
+	 *            the object to search for
+	 * @return the index of the last occurrence of the object
+	 */
+	public int lastIndexOf(Object object) {
+		int pos = size;
+		Link link = voidLink.previous;
+		if (object != null) {
+			while (link != voidLink) {
+				pos--;
+				if (object.equals(link.data))
+					return pos;
+				link = link.previous;
+			}
+		} else {
+			while (link != voidLink) {
+				pos--;
+				if (link.data == null)
+					return pos;
+				link = link.previous;
+			}
+		}
+		return -1;
+	}
+
+	/**
+	 * Answers a ListIterator on the elements of this LinkedList. The elements
+	 * are iterated in the same order that they occur in the LinkedList. The
+	 * iteration starts at the specified location.
+	 * 
+	 * @param location
+	 *            the index at which to start the iteration
+	 * @return a ListIterator on the elements of this LinkedList
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 * 
+	 * @see ListIterator
+	 */
+	public ListIterator listIterator(int location) {
+		return new LinkIterator(this, location);
+	}
+
+	/**
+	 * Removes the object at the specified location from this LinkedList.
+	 * 
+	 * @param location
+	 *            the index of the object to remove
+	 * @return the removed object
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public Object remove(int location) {
+		if (0 <= location && location < size) {
+			Link link = voidLink;
+			if (location < (size / 2)) {
+				for (int i = 0; i <= location; i++)
+					link = link.next;
+			} else {
+				for (int i = size; i > location; i--)
+					link = link.previous;
+			}
+			Link previous = link.previous;
+			Link next = link.next;
+			previous.next = next;
+			next.previous = previous;
+			size--;
+			modCount++;
+			return link.data;
+		} else
+			throw new IndexOutOfBoundsException();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.Collection#remove(java.lang.Object)
+	 */
+	public boolean remove(Object object) {
+		Link link = voidLink.next;
+		if (object != null) {
+			while (link != voidLink && !object.equals(link.data))
+				link = link.next;
+		} else {
+			while (link != voidLink && link.data != null)
+				link = link.next;
+		}
+		if (link == voidLink)
+			return false;
+		Link next = link.next;
+		Link previous = link.previous;
+		previous.next = next;
+		next.previous = previous;
+		size--;
+		modCount++;
+		return true;
+	}
+
+	/**
+	 * Removes the first object from this LinkedList.
+	 * 
+	 * @return the removed object
+	 * 
+	 * @exception NoSuchElementException
+	 *                when this LinkedList is empty
+	 */
+	public Object removeFirst() {
+		Link first = voidLink.next;
+		if (first != voidLink) {
+			Link next = first.next;
+			voidLink.next = next;
+			next.previous = voidLink;
+			size--;
+			modCount++;
+			return first.data;
+		} else
+			throw new NoSuchElementException();
+	}
+
+	/**
+	 * Removes the last object from this LinkedList.
+	 * 
+	 * @return the removed object
+	 * 
+	 * @exception NoSuchElementException
+	 *                when this LinkedList is empty
+	 */
+	public Object removeLast() {
+		Link last = voidLink.previous;
+		if (last != voidLink) {
+			Link previous = last.previous;
+			voidLink.previous = previous;
+			previous.next = voidLink;
+			size--;
+			modCount++;
+			return last.data;
+		} else
+			throw new NoSuchElementException();
+	}
+
+	/**
+	 * Replaces the element at the specified location in this LinkedList with
+	 * the specified object.
+	 * 
+	 * @param location
+	 *            the index at which to put the specified object
+	 * @param object
+	 *            the object to add
+	 * @return the previous element at the index
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public Object set(int location, Object object) {
+		if (0 <= location && location < size) {
+			Link link = voidLink;
+			if (location < (size / 2)) {
+				for (int i = 0; i <= location; i++)
+					link = link.next;
+			} else {
+				for (int i = size; i > location; i--)
+					link = link.previous;
+			}
+			Object result = link.data;
+			link.data = object;
+			return result;
+		} else
+			throw new IndexOutOfBoundsException();
+	}
+
+	/**
+	 * Answers the number of elements in this LinkedList.
+	 * 
+	 * @return the number of elements in this LinkedList
+	 */
+	public int size() {
+		return size;
+	}
+
+	/**
+	 * Answers a new array containing all elements contained in this LinkedList.
+	 * 
+	 * @return an array of the elements from this LinkedList
+	 */
+	public Object[] toArray() {
+		int index = 0;
+		Object[] contents = new Object[size];
+		Link link = voidLink.next;
+		while (link != voidLink) {
+			contents[index++] = link.data;
+			link = link.next;
+		}
+		return contents;
+	}
+
+	/**
+	 * Answers an array containing all elements contained in this LinkedList. If
+	 * the specified array is large enough to hold the elements, the specified
+	 * array is used, otherwise an array of the same type is created. If the
+	 * specified array is used and is larger than this LinkedList, the array
+	 * element following the collection elements is set to null.
+	 * 
+	 * @param contents
+	 *            the array
+	 * @return an array of the elements from this LinkedList
+	 * 
+	 * @exception ArrayStoreException
+	 *                when the type of an element in this LinkedList cannot be
+	 *                stored in the type of the specified array
+	 */
+	public Object[] toArray(Object[] contents) {
+		int index = 0;
+		if (size > contents.length)
+			contents = (Object[]) Array.newInstance(contents.getClass()
+					.getComponentType(), size);
+		Link link = voidLink.next;
+		while (link != voidLink) {
+			contents[index++] = link.data;
+			link = link.next;
+		}
+		if (index < contents.length)
+			contents[index] = null;
+		return contents;
+	}
+
+	private void writeObject(ObjectOutputStream stream) throws IOException {
+		stream.defaultWriteObject();
+		stream.writeInt(size);
+		Iterator it = iterator();
+		while (it.hasNext())
+			stream.writeObject(it.next());
+	}
+
+	private void readObject(ObjectInputStream stream) throws IOException,
+			ClassNotFoundException {
+		stream.defaultReadObject();
+		size = stream.readInt();
+		voidLink = new Link(null, null, null);
+		Link link = voidLink;
+		for (int i = size; --i >= 0;) {
+			Link nextLink = new Link(stream.readObject(), link, null);
+			link.next = nextLink;
+			link = nextLink;
+		}
+		link.next = voidLink;
+		voidLink.previous = link;
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/List.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/List.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/List.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/List.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,353 @@
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * List is a collection which maintains an ordering for its elements. Every
+ * element in the list has an index.
+ */
+public interface List extends Collection {
+	/**
+	 * Inserts the specified object into this Vector at the specified location.
+	 * The object is inserted before any previous element at the specified
+	 * location. If the location is equal to the size of this List, the object
+	 * is added at the end.
+	 * 
+	 * @param location
+	 *            the index at which to insert
+	 * @param object
+	 *            the object to add
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding to this List is not supported
+	 * @exception ClassCastException
+	 *                when the class of the object is inappropriate for this
+	 *                List
+	 * @exception IllegalArgumentException
+	 *                when the object cannot be added to this List
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public void add(int location, Object object);
+
+	/**
+	 * Adds the specified object at the end of this List.
+	 * 
+	 * @param object
+	 *            the object to add
+	 * @return true
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding to this List is not supported
+	 * @exception ClassCastException
+	 *                when the class of the object is inappropriate for this
+	 *                List
+	 * @exception IllegalArgumentException
+	 *                when the object cannot be added to this List
+	 */
+	public boolean add(Object object);
+
+	/**
+	 * Inserts the objects in the specified Collection at the specified location
+	 * in this List. The objects are added in the order they are returned from
+	 * the Collection iterator.
+	 * 
+	 * @param location
+	 *            the index at which to insert
+	 * @param collection
+	 *            the Collection of objects
+	 * @return true if this List is modified, false otherwise
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding to this List is not supported
+	 * @exception ClassCastException
+	 *                when the class of an object is inappropriate for this List
+	 * @exception IllegalArgumentException
+	 *                when an object cannot be added to this List
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public boolean addAll(int location, Collection collection);
+
+	/**
+	 * Adds the objects in the specified Collection to the end of this List. The
+	 * objects are added in the order they are returned from the Collection
+	 * iterator.
+	 * 
+	 * @param collection
+	 *            the Collection of objects
+	 * @return true if this List is modified, false otherwise
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding to this List is not supported
+	 * @exception ClassCastException
+	 *                when the class of an object is inappropriate for this List
+	 * @exception IllegalArgumentException
+	 *                when an object cannot be added to this List
+	 */
+	public boolean addAll(Collection collection);
+
+	/**
+	 * Removes all elements from this List, leaving it empty.
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this List is not supported
+	 * 
+	 * @see #isEmpty
+	 * @see #size
+	 */
+	public void clear();
+
+	/**
+	 * Searches this List for the specified object.
+	 * 
+	 * @param object
+	 *            the object to search for
+	 * @return true if object is an element of this List, false otherwise
+	 */
+	public boolean contains(Object object);
+
+	/**
+	 * Searches this List for all objects in the specified Collection.
+	 * 
+	 * @param collection
+	 *            the Collection of objects
+	 * @return true if all objects in the specified Collection are elements of
+	 *         this List, false otherwise
+	 */
+	public boolean containsAll(Collection collection);
+
+	/**
+	 * Compares the argument to the receiver, and answers true if they represent
+	 * the <em>same</em> object using a class specific comparison.
+	 * 
+	 * @param object
+	 *            Object the object to compare with this object.
+	 * @return boolean <code>true</code> if the object is the same as this
+	 *         object <code>false</code> if it is different from this object.
+	 * @see #hashCode
+	 */
+	public boolean equals(Object object);
+
+	/**
+	 * Answers the element at the specified location in this List.
+	 * 
+	 * @param location
+	 *            the index of the element to return
+	 * @return the element at the specified location
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public Object get(int location);
+
+	/**
+	 * Answers an integer hash code for the receiver. Objects which are equal
+	 * answer the same value for this method.
+	 * 
+	 * @return the receiver's hash
+	 * 
+	 * @see #equals
+	 */
+	public int hashCode();
+
+	/**
+	 * Searches this List for the specified object and returns the index of the
+	 * first occurrence.
+	 * 
+	 * @param object
+	 *            the object to search for
+	 * @return the index of the first occurrence of the object
+	 */
+	public int indexOf(Object object);
+
+	/**
+	 * Answers if this List has no elements, a size of zero.
+	 * 
+	 * @return true if this List has no elements, false otherwise
+	 * 
+	 * @see #size
+	 */
+	public boolean isEmpty();
+
+	/**
+	 * Answers an Iterator on the elements of this List. The elements are
+	 * iterated in the same order that they occur in the List.
+	 * 
+	 * @return an Iterator on the elements of this List
+	 * 
+	 * @see Iterator
+	 */
+	public Iterator iterator();
+
+	/**
+	 * Searches this List for the specified object and returns the index of the
+	 * last occurrence.
+	 * 
+	 * @param object
+	 *            the object to search for
+	 * @return the index of the last occurrence of the object
+	 */
+	public int lastIndexOf(Object object);
+
+	/**
+	 * Answers a ListIterator on the elements of this List. The elements are
+	 * iterated in the same order that they occur in the List.
+	 * 
+	 * @return a ListIterator on the elements of this List
+	 * 
+	 * @see ListIterator
+	 */
+	public ListIterator listIterator();
+
+	/**
+	 * Answers a ListIterator on the elements of this List. The elements are
+	 * iterated in the same order that they occur in the List. The iteration
+	 * starts at the specified location.
+	 * 
+	 * @param location
+	 *            the index at which to start the iteration
+	 * @return a ListIterator on the elements of this List
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 * 
+	 * @see ListIterator
+	 */
+	public ListIterator listIterator(int location);
+
+	/**
+	 * Removes the object at the specified location from this List.
+	 * 
+	 * @param location
+	 *            the index of the object to remove
+	 * @return the removed object
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this List is not supported
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public Object remove(int location);
+
+	/**
+	 * Removes the first occurrence of the specified object from this List.
+	 * 
+	 * @param object
+	 *            the object to remove
+	 * @return true if this List is modified, false otherwise
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this List is not supported
+	 */
+	public boolean remove(Object object);
+
+	/**
+	 * Removes all occurrences in this List of each object in the specified
+	 * Collection.
+	 * 
+	 * @param collection
+	 *            the Collection of objects to remove
+	 * @return true if this List is modified, false otherwise
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this List is not supported
+	 */
+	public boolean removeAll(Collection collection);
+
+	/**
+	 * Removes all objects from this List that are not contained in the
+	 * specified Collection.
+	 * 
+	 * @param collection
+	 *            the Collection of objects to retain
+	 * @return true if this List is modified, false otherwise
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this List is not supported
+	 */
+	public boolean retainAll(Collection collection);
+
+	/**
+	 * Replaces the element at the specified location in this List with the
+	 * specified object.
+	 * 
+	 * @param location
+	 *            the index at which to put the specified object
+	 * @param object
+	 *            the object to add
+	 * @return the previous element at the index
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when replacing elements in this List is not supported
+	 * @exception ClassCastException
+	 *                when the class of an object is inappropriate for this List
+	 * @exception IllegalArgumentException
+	 *                when an object cannot be added to this List
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>location < 0 || >= size()</code>
+	 */
+	public Object set(int location, Object object);
+
+	/**
+	 * Answers the number of elements in this List.
+	 * 
+	 * @return the number of elements in this List
+	 */
+	public int size();
+
+	/**
+	 * Answers a List of the specified portion of this List from the start index
+	 * to one less than the end index. The returned List is backed by this list
+	 * so changes to one are reflected by the other.
+	 * 
+	 * @param start
+	 *            the index at which to start the sublist
+	 * @param end
+	 *            the index one past the end of the sublist
+	 * @return a List of a portion of this List
+	 * 
+	 * @exception IndexOutOfBoundsException
+	 *                when <code>start < 0, start > end</code> or
+	 *                <code>end > size()</code>
+	 */
+	public List subList(int start, int end);
+
+	/**
+	 * Answers an array containing all elements contained in this List.
+	 * 
+	 * @return an array of the elements from this List
+	 */
+	public Object[] toArray();
+
+	/**
+	 * Answers an array containing all elements contained in this List. If the
+	 * specified array is large enough to hold the elements, the specified array
+	 * is used, otherwise an array of the same type is created. If the specified
+	 * array is used and is larger than this List, the array element following
+	 * the collection elements is set to null.
+	 * 
+	 * @param array
+	 *            the array
+	 * @return an array of the elements from this List
+	 * 
+	 * @exception ArrayStoreException
+	 *                when the type of an element in this List cannot be stored
+	 *                in the type of the specified array
+	 */
+	public Object[] toArray(Object[] array);
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListIterator.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListIterator.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListIterator.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListIterator.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,142 @@
+/* Copyright 1998, 2002 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * An ListIterator is used to sequence over a List of objects. ListIterator can
+ * move backwards or forwards through the List.
+ */
+public interface ListIterator extends Iterator {
+	
+	/**
+	 * Inserts the specified object into the list between <code>next</code>
+	 * and <code>previous</code>. The object inserted will be the previous
+	 * object.
+	 * 
+	 * @param object
+	 *            the object to insert
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding is not supported by the list being iterated
+	 * @exception ClassCastException
+	 *                when the class of the object is inappropriate for the list
+	 * @exception IllegalArgumentException
+	 *                when the object cannot be added to the list
+	 */
+	void add(Object object);
+
+	/**
+	 * Answers if there are more elements to iterate.
+	 * 
+	 * @return true if there are more elements, false otherwise
+	 * 
+	 * @see #next
+	 */
+	public boolean hasNext();
+
+	/**
+	 * Answers if there are previous elements to iterate.
+	 * 
+	 * @return true if there are previous elements, false otherwise
+	 * 
+	 * @see #previous
+	 */
+	public boolean hasPrevious();
+
+	/**
+	 * Answers the next object in the iteration.
+	 * 
+	 * @return the next object
+	 * 
+	 * @exception NoSuchElementException
+	 *                when there are no more elements
+	 * 
+	 * @see #hasNext
+	 */
+	public Object next();
+
+	/**
+	 * Answers the index of the next object in the iteration.
+	 * 
+	 * @return the index of the next object
+	 * 
+	 * @exception NoSuchElementException
+	 *                when there are no more elements
+	 * 
+	 * @see #next
+	 */
+	public int nextIndex();
+
+	/**
+	 * Answers the previous object in the iteration.
+	 * 
+	 * @return the previous object
+	 * 
+	 * @exception NoSuchElementException
+	 *                when there are no previous elements
+	 * 
+	 * @see #hasPrevious
+	 */
+	public Object previous();
+
+	/**
+	 * Answers the index of the previous object in the iteration.
+	 * 
+	 * @return the index of the previous object
+	 * 
+	 * @exception NoSuchElementException
+	 *                when there are no previous elements
+	 * 
+	 * @see #previous
+	 */
+	public int previousIndex();
+
+	/**
+	 * Removes the last object returned by <code>next</code> or
+	 * <code>previous</code> from the list.
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing is not supported by the list being iterated
+	 * @exception IllegalStateException
+	 *                when <code>next</code> or <code>previous</code> have
+	 *                not been called, or <code>remove</code> or
+	 *                <code>add</code> have already been called after the last
+	 *                call to <code>next</code> or <code>previous</code>
+	 */
+	public void remove();
+
+	/**
+	 * Replaces the last object returned by <code>next</code> or
+	 * <code>previous</code> with the specified object.
+	 * 
+	 * @param object
+	 *            the object to add
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding is not supported by the list being iterated
+	 * @exception ClassCastException
+	 *                when the class of the object is inappropriate for the list
+	 * @exception IllegalArgumentException
+	 *                when the object cannot be added to the list
+	 * @exception IllegalStateException
+	 *                when <code>next</code> or <code>previous</code> have
+	 *                not been called, or <code>remove</code> or
+	 *                <code>add</code> have already been called after the last
+	 *                call to <code>next</code> or <code>previous</code>
+	 */
+	void set(Object object);
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListResourceBundle.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListResourceBundle.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListResourceBundle.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/ListResourceBundle.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,119 @@
+/* Copyright 1998, 2003 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * ListResourceBundle is the abstract superclass of classes which provide
+ * resources by implementing the <code>getContents()</code> method to return
+ * the list of resources.
+ * 
+ * @see ResourceBundle
+ */
+public abstract class ListResourceBundle extends ResourceBundle {
+	
+	Hashtable table;
+
+	/**
+	 * Constructs a new instance of this class.
+	 */
+	public ListResourceBundle() {
+		super();
+	}
+
+	/**
+	 * Answers an Object array which contains the resources of this
+	 * ListResourceBundle. Each element in the array is an array of two
+	 * elements, the first is the resource key and the second is the resource.
+	 * 
+	 * @return a Object array containing the resources
+	 */
+	abstract protected Object[][] getContents();
+
+	/**
+	 * Answers the names of the resources contained in this ListResourceBundle.
+	 * 
+	 * @return an Enumeration of the resource names
+	 */
+	public Enumeration getKeys() {
+		if (table == null)
+			initializeTable();
+		if (parent == null)
+			return table.keys();
+		return new Enumeration() {
+			Enumeration local = table.keys();
+
+			Enumeration pEnum = parent.getKeys();
+
+			Object nextElement = null;
+
+			private boolean findNext() {
+				if (nextElement != null)
+					return true;
+				while (pEnum.hasMoreElements()) {
+					String next = (String) pEnum.nextElement();
+					if (!table.containsKey(next)) {
+						nextElement = next;
+						return true;
+					}
+				}
+				return false;
+			}
+
+			public boolean hasMoreElements() {
+				if (local.hasMoreElements())
+					return true;
+				return findNext();
+			}
+
+			public Object nextElement() {
+				if (local.hasMoreElements())
+					return local.nextElement();
+				if (findNext()) {
+					Object result = nextElement;
+					nextElement = null;
+					return result;
+				}
+				// Cause an exception
+				return pEnum.nextElement();
+			}
+		};
+	}
+
+	/**
+	 * Answers the named resource from this ResourceBundle, or null if the
+	 * resource is not found.
+	 * 
+	 * @param key
+	 *            the name of the resource
+	 * @return the resource object
+	 */
+	public final Object handleGetObject(String key) {
+		if (table == null)
+			initializeTable();
+		return table.get(key);
+	}
+
+	private synchronized void initializeTable() {
+		if (table == null) {
+			Object[][] contents = getContents();
+			table = new Hashtable(contents.length / 3 * 4 + 3);
+			for (int i = 0; i < contents.length; i++) {
+				table.put(contents[i][0], contents[i][1]);
+			}
+		}
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Locale.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Locale.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Locale.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Locale.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,724 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.io.Serializable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import com.ibm.oti.locale.Country;
+import com.ibm.oti.locale.Language;
+import com.ibm.oti.util.PriviAction;
+
+/**
+ * Locale represents a language/country/variant combination. It is an identifier
+ * which dictates particular conventions for the presentation of information.
+ * The language codes are two letter lowercase codes as defined by ISO-639. The
+ * country codes are three letter uppercase codes as defined by ISO-3166. The
+ * variant codes are unspecified.
+ * 
+ * @see ResourceBundle
+ */
+public final class Locale implements Cloneable, Serializable {
+	
+	static final long serialVersionUID = 9149081749638150636L;
+
+	transient private String countryCode, languageCode, variantCode;
+
+	private static Locale[] availableLocales;
+
+	// Initialize a default which is used during static
+	// initialization of the default for the platform.
+	private static Locale defaultLocale = new Locale();
+
+	/**
+	 * Locale constant for en_CA.
+	 */
+	public static final Locale CANADA = new Locale("en", "CA"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for fr_CA.
+	 */
+	public static final Locale CANADA_FRENCH = new Locale("fr", "CA"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for zh_CN.
+	 */
+	public static final Locale CHINA = new Locale("zh", "CN"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for zh.
+	 */
+	public static final Locale CHINESE = new Locale("zh", "");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for en.
+	 */
+	public static final Locale ENGLISH = new Locale("en", ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for fr_FR.
+	 */
+	public static final Locale FRANCE = new Locale("fr", "FR");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for fr.
+	 */
+	public static final Locale FRENCH = new Locale("fr", "");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for de.
+	 */
+	public static final Locale GERMAN = new Locale("de", ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for de_DE.
+	 */
+	public static final Locale GERMANY = new Locale("de", "DE"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for it.
+	 */
+	public static final Locale ITALIAN = new Locale("it", ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for it_IT.
+	 */
+	public static final Locale ITALY = new Locale("it", "IT"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for ja_JP.
+	 */
+	public static final Locale JAPAN = new Locale("ja", "JP");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for ja.
+	 */
+	public static final Locale JAPANESE = new Locale("ja", "");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for ko_KR.
+	 */
+	public static final Locale KOREA = new Locale("ko", "KR");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for ko.
+	 */
+	public static final Locale KOREAN = new Locale("ko", "");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for zh_CN.
+	 */
+	public static final Locale PRC = new Locale("zh", "CN");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for zh_CN.
+	 */
+	public static final Locale SIMPLIFIED_CHINESE = new Locale("zh", "CN");  //$NON-NLS-1$//$NON-NLS-2$
+
+	/**
+	 * Locale constant for zh_TW.
+	 */
+	public static final Locale TAIWAN = new Locale("zh", "TW"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for zh_TW.
+	 */
+	public static final Locale TRADITIONAL_CHINESE = new Locale("zh", "TW"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for en_GB.
+	 */
+	public static final Locale UK = new Locale("en", "GB"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Locale constant for en_US.
+	 */
+	public static final Locale US = new Locale("en", "US");  //$NON-NLS-1$//$NON-NLS-2$
+
+	private static final PropertyPermission setLocalePermission = new PropertyPermission(
+			"user.language", "write");  //$NON-NLS-1$//$NON-NLS-2$
+
+	static {
+		String language = (String) AccessController
+				.doPrivileged(new PriviAction("user.language", "en")); //$NON-NLS-1$ //$NON-NLS-2$
+		String region = (String) AccessController.doPrivileged(new PriviAction(
+				"user.country", "US")); //$NON-NLS-1$ //$NON-NLS-2$
+		String variant = (String) AccessController
+				.doPrivileged(new PriviAction("user.variant", "")); //$NON-NLS-1$ //$NON-NLS-2$
+		defaultLocale = new Locale(language, region, variant);
+	}
+
+	/**
+	 * Constructs a default which is used during static initialization of the
+	 * default for the platform.
+	 */
+	private Locale() {
+		languageCode = "en"; //$NON-NLS-1$
+		countryCode = "US"; //$NON-NLS-1$
+		variantCode = ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Constructs a new Locale using the specified language.
+	 * @param language 
+	 * 
+	 */
+	public Locale(String language) {
+		this(language, "", "");  //$NON-NLS-1$//$NON-NLS-2$
+	}
+
+	/**
+	 * Constructs a new Locale using the specified language and country codes.
+	 * @param language 
+	 * @param country 
+	 * 
+	 */
+	public Locale(String language, String country) {
+		this(language, country, ""); //$NON-NLS-1$
+	}
+
+	/**
+	 * Constructs a new Locale using the specified language, country, and
+	 * variant codes.
+	 * @param language 
+	 * @param country 
+	 * @param variant 
+	 * 
+	 */
+	public Locale(String language, String country, String variant) {
+		languageCode = language.toLowerCase();
+		// Map new language codes to the obsolete language
+		// codes so the correct resource bundles will be used.
+		if (languageCode.equals("he")) //$NON-NLS-1$
+			languageCode = "iw"; //$NON-NLS-1$
+		else if (languageCode.equals("id")) //$NON-NLS-1$
+			languageCode = "in"; //$NON-NLS-1$
+		else if (languageCode.equals("yi")) //$NON-NLS-1$
+			languageCode = "ji"; //$NON-NLS-1$
+		countryCode = country.toUpperCase();
+		variantCode = variant.toUpperCase();
+	}
+
+	/**
+	 * Answers a new Locale with the same language, country and variant codes as
+	 * this Locale.
+	 * 
+	 * @return a shallow copy of this Locale
+	 * 
+	 * @see java.lang.Cloneable
+	 */
+	public Object clone() {
+		try {
+			return super.clone();
+		} catch (CloneNotSupportedException e) {
+			return null;
+		}
+	}
+
+	/**
+	 * Compares the specified object to this Locale and answer if they are
+	 * equal. The object must be an instance of Locale and have the same
+	 * language, country and variant.
+	 * 
+	 * @param object
+	 *            the object to compare with this object
+	 * @return true if the specified object is equal to this Locale, false
+	 *         otherwise
+	 * 
+	 * @see #hashCode
+	 */
+	public boolean equals(Object object) {
+		if (object == this)
+			return true;
+		if (object instanceof Locale) {
+			Locale o = (Locale) object;
+			return languageCode.equals(o.languageCode)
+					&& countryCode.equals(o.countryCode)
+					&& variantCode.equals(o.variantCode);
+		}
+		return false;
+	}
+
+	static Locale[] find(String prefix) {
+		int last = prefix.lastIndexOf('/');
+		final String thePackage = prefix.substring(0, last + 1);
+		final String classPrefix = prefix.substring(last + 1, prefix.length());
+		FilenameFilter filter = new FilenameFilter() {
+			public boolean accept(File dir, String name) {
+				return name.startsWith(classPrefix);
+			}
+		};
+		Vector result = new Vector();
+		StringTokenizer paths = new StringTokenizer(System.getProperty(
+				"com.ibm.oti.system.class.path", ""), System.getProperty( //$NON-NLS-1$ //$NON-NLS-2$
+				"path.separator", ";"));  //$NON-NLS-1$//$NON-NLS-2$
+		while (paths.hasMoreTokens()) {
+			String nextToken = paths.nextToken();
+			File directory = new File(nextToken);
+			if (directory.exists()) {
+				if (directory.isDirectory()) {
+					try {
+						File newDir;
+						String path = directory.getCanonicalPath();
+						if (path.charAt(path.length() - 1) == File.separatorChar)
+							newDir = new File(path + thePackage);
+						else
+							newDir = new File(path + File.separatorChar
+									+ thePackage);
+						if (newDir.isDirectory()) {
+							String[] list = newDir.list(filter);
+							for (int j = 0; j < list.length; j++)
+								result.addElement(list[j]);
+						}
+					} catch (IOException e) {
+					}
+				} else {
+					// Handle ZIP/JAR files.
+					try {
+						ZipFile zip = new ZipFile(directory);
+						Enumeration entries = zip.entries();
+						while (entries.hasMoreElements()) {
+							String name = ((ZipEntry) entries.nextElement())
+									.getName();
+							if (name.startsWith(prefix)
+									&& name.endsWith(".class")) //$NON-NLS-1$
+								result.addElement(name);
+						}
+						zip.close();
+					} catch (IOException e) {
+					}
+				}
+			}
+		}
+		Locale[] locales = new Locale[result.size()];
+		for (int i = 0; i < result.size(); i++) {
+			String name = (String) result.elementAt(i);
+			name = name.substring(0, name.length() - 6); // remove .class
+			int index = name.indexOf('_');
+			int nextIndex = name.indexOf('_', index + 1);
+			if (nextIndex == -1) {
+				locales[i] = new Locale(name
+						.substring(index + 1, name.length()), ""); //$NON-NLS-1$
+				continue;
+			}
+			String language = name.substring(index + 1, nextIndex);
+			String variant;
+			if ((index = name.indexOf('_', nextIndex + 1)) == -1) {
+				variant = ""; //$NON-NLS-1$
+				index = name.length();
+			} else
+				variant = name.substring(index + 1, name.length());
+			String country = name.substring(nextIndex + 1, index);
+			locales[i] = new Locale(language, country, variant);
+		}
+		return locales;
+	}
+
+	/**
+	 * Gets the list of installed Locales.
+	 * 
+	 * @return an array of Locale
+	 */
+	public static Locale[] getAvailableLocales() {
+		if (availableLocales == null) {
+			availableLocales = (Locale[]) AccessController
+					.doPrivileged(new PrivilegedAction() {
+						public Object run() {
+							return find("com/ibm/oti/locale/Locale_"); //$NON-NLS-1$
+						}
+					});
+		}
+		return (Locale[]) availableLocales.clone();
+	}
+
+	/**
+	 * Gets the country code for this Locale.
+	 * 
+	 * @return a country code
+	 */
+	public String getCountry() {
+		return countryCode;
+	}
+
+	/**
+	 * Gets the default Locale.
+	 * 
+	 * @return the default Locale
+	 */
+	public static Locale getDefault() {
+		return defaultLocale;
+	}
+
+	/**
+	 * Gets the full country name in the default Locale for the country code of
+	 * this Locale. If there is no matching country name, the country code is
+	 * returned.
+	 * 
+	 * @return a country name
+	 */
+	public final String getDisplayCountry() {
+		return getDisplayCountry(getDefault());
+	}
+
+	/**
+	 * Gets the full country name in the specified Locale for the country code
+	 * of this Locale. If there is no matching country name, the country code is
+	 * returned.
+	 * 
+	 * @param locale
+	 *            the Locale
+	 * @return a country name
+	 */
+	public String getDisplayCountry(Locale locale) {
+		if (countryCode.length() == 0)
+			return countryCode;
+		try {
+			// First try the specified locale
+			ResourceBundle bundle = getBundle("Country", locale); //$NON-NLS-1$
+			String result = (String) bundle.handleGetObject(countryCode);
+			if (result != null)
+				return result;
+			// Now use the default locale
+			if (locale != Locale.getDefault())
+				bundle = getBundle("Country", Locale.getDefault()); //$NON-NLS-1$
+			return bundle.getString(countryCode);
+		} catch (MissingResourceException e) {
+			return countryCode;
+		}
+	}
+
+	/**
+	 * Gets the full language name in the default Locale for the language code
+	 * of this Locale. If there is no matching language name, the language code
+	 * is returned.
+	 * 
+	 * @return a language name
+	 */
+	public final String getDisplayLanguage() {
+		return getDisplayLanguage(getDefault());
+	}
+
+	/**
+	 * Gets the full language name in the specified Locale for the language code
+	 * of this Locale. If there is no matching language name, the language code
+	 * is returned.
+	 * 
+	 * @param locale
+	 *            the Locale
+	 * @return a language name
+	 */
+	public String getDisplayLanguage(Locale locale) {
+		if (languageCode.length() == 0)
+			return languageCode;
+		try {
+			// First try the specified locale
+			ResourceBundle bundle = getBundle("Language", locale); //$NON-NLS-1$
+			String result = (String) bundle.handleGetObject(languageCode);
+			if (result != null)
+				return result;
+			// Now use the default locale
+			if (locale != Locale.getDefault())
+				bundle = getBundle("Language", Locale.getDefault()); //$NON-NLS-1$
+			return bundle.getString(languageCode);
+		} catch (MissingResourceException e) {
+			return languageCode;
+		}
+	}
+
+	/**
+	 * Gets the full language, country, and variant names in the default Locale
+	 * for the codes of this Locale.
+	 * 
+	 * @return a Locale name
+	 */
+	public final String getDisplayName() {
+		return getDisplayName(getDefault());
+	}
+
+	/**
+	 * Gets the full language, country, and variant names in the specified
+	 * Locale for the codes of this Locale.
+	 * 
+	 * @param locale
+	 *            the Locale
+	 * @return a Locale name
+	 */
+	public String getDisplayName(Locale locale) {
+		int count = 0;
+		StringBuffer buffer = new StringBuffer();
+		if (languageCode.length() > 0) {
+			buffer.append(getDisplayLanguage(locale));
+			count++;
+		}
+		if (countryCode.length() > 0) {
+			if (count == 1)
+				buffer.append(" ("); //$NON-NLS-1$
+			buffer.append(getDisplayCountry(locale));
+			count++;
+		}
+		if (variantCode.length() > 0) {
+			if (count == 1)
+				buffer.append(" ("); //$NON-NLS-1$
+			else if (count == 2)
+				buffer.append(","); //$NON-NLS-1$
+			buffer.append(getDisplayVariant(locale));
+			count++;
+		}
+		if (count > 1)
+			buffer.append(")"); //$NON-NLS-1$
+		return buffer.toString();
+	}
+
+	/**
+	 * Gets the full variant name in the default Locale for the variant code of
+	 * this Locale. If there is no matching variant name, the variant code is
+	 * returned.
+	 * 
+	 * @return a variant name
+	 */
+	public final String getDisplayVariant() {
+		return getDisplayVariant(getDefault());
+	}
+
+	/**
+	 * Gets the full variant name in the specified Locale for the variant code
+	 * of this Locale. If there is no matching variant name, the variant code is
+	 * returned.
+	 * 
+	 * @param locale
+	 *            the Locale
+	 * @return a variant name
+	 */
+	public String getDisplayVariant(Locale locale) {
+		if (variantCode.length() == 0)
+			return variantCode;
+		ResourceBundle bundle;
+		try {
+			bundle = getBundle("Variant", locale); //$NON-NLS-1$
+		} catch (MissingResourceException e) {
+			return variantCode.replace('_', ',');
+		}
+
+		StringBuffer result = new StringBuffer();
+		StringTokenizer tokens = new StringTokenizer(variantCode, "_"); //$NON-NLS-1$
+		while (tokens.hasMoreTokens()) {
+			String code, variant = tokens.nextToken();
+			try {
+				code = bundle.getString(variant);
+			} catch (MissingResourceException e) {
+				code = variant;
+			}
+			result.append(code);
+			if (tokens.hasMoreTokens())
+				result.append(',');
+		}
+		return result.toString();
+	}
+
+	/**
+	 * Gets the three letter ISO country code which corresponds to the country
+	 * code for this Locale.
+	 * 
+	 * @return a three letter ISO language code
+	 * 
+	 * @exception MissingResourceException
+	 *                when there is no matching three letter ISO country code
+	 */
+	public String getISO3Country() throws MissingResourceException {
+		if (countryCode.length() == 0)
+			return ""; //$NON-NLS-1$
+		ResourceBundle bundle = getBundle("ISO3Countries", this); //$NON-NLS-1$
+		return bundle.getString(countryCode);
+	}
+
+	/**
+	 * Gets the three letter ISO language code which corresponds to the language
+	 * code for this Locale.
+	 * 
+	 * @return a three letter ISO language code
+	 * 
+	 * @exception MissingResourceException
+	 *                when there is no matching three letter ISO language code
+	 */
+	public String getISO3Language() throws MissingResourceException {
+		if (languageCode.length() == 0)
+			return ""; //$NON-NLS-1$
+		ResourceBundle bundle = getBundle("ISO3Languages", this); //$NON-NLS-1$
+		return bundle.getString(languageCode);
+	}
+
+	/**
+	 * Gets the list of two letter ISO country codes which can be used as the
+	 * country code for a Locale.
+	 * 
+	 * @return an array of String
+	 */
+	public static String[] getISOCountries() {
+		ListResourceBundle bundle = new Country();
+
+		boolean hasCS = false;
+		try {
+			bundle.getString("CS"); //$NON-NLS-1$
+			hasCS = true;
+		} catch (MissingResourceException e) {
+		}
+
+		Enumeration keys = bundle.getKeys(); // to initialize the table
+		int size = bundle.table.size();
+		if (hasCS)
+			size--;
+		String[] result = new String[size];
+		int index = 0;
+		while (keys.hasMoreElements()) {
+			String element = (String) keys.nextElement();
+			if (!element.equals("CS")) //$NON-NLS-1$
+				result[index++] = element;
+		}
+		return result;
+	}
+
+	/**
+	 * Gets the list of two letter ISO language codes which can be used as the
+	 * language code for a Locale.
+	 * 
+	 * @return an array of String
+	 */
+	public static String[] getISOLanguages() {
+		ListResourceBundle bundle = new Language();
+		Enumeration keys = bundle.getKeys(); // to initialize the table
+		String[] result = new String[bundle.table.size()];
+		int index = 0;
+		while (keys.hasMoreElements())
+			result[index++] = (String) keys.nextElement();
+		return result;
+	}
+
+	/**
+	 * Gets the language code for this Locale.
+	 * 
+	 * @return a language code
+	 */
+	public String getLanguage() {
+		return languageCode;
+	}
+
+	/**
+	 * Gets the variant code for this Locale.
+	 * 
+	 * @return a variant code
+	 */
+	public String getVariant() {
+		return variantCode;
+	}
+
+	/**
+	 * Answers an integer hash code for the receiver. Objects which are equal
+	 * answer the same value for this method.
+	 * 
+	 * @return the receiver's hash
+	 * 
+	 * @see #equals
+	 */
+	public synchronized int hashCode() {
+		return countryCode.hashCode() + languageCode.hashCode()
+				+ variantCode.hashCode();
+	}
+
+	/**
+	 * Sets the default Locale to the specified Locale.
+	 * 
+	 * @param locale
+	 *            the new default Locale
+	 * 
+	 * @exception SecurityException
+	 *                when there is a security manager which does not allow this
+	 *                operation
+	 */
+	public synchronized static void setDefault(Locale locale) {
+		if (locale != null) {
+			SecurityManager security = System.getSecurityManager();
+			if (security != null)
+				security.checkPermission(setLocalePermission);
+			defaultLocale = locale;
+		} else
+			throw new NullPointerException();
+	}
+
+	/**
+	 * Answers the string representation of this Locale.
+	 * 
+	 * @return the string representation of this Locale
+	 */
+	public final String toString() {
+		StringBuffer result = new StringBuffer();
+		result.append(languageCode);
+		if (countryCode.length() > 0) {
+			result.append('_');
+			result.append(countryCode);
+		}
+		if (variantCode.length() > 0) {
+			if (countryCode.length() == 0)
+				result.append("__"); //$NON-NLS-1$
+			else
+				result.append('_');
+			result.append(variantCode);
+		}
+		return result.toString();
+	}
+
+	static ResourceBundle getBundle(final String clName, final Locale locale) {
+		return (ResourceBundle) AccessController
+				.doPrivileged(new PrivilegedAction() {
+					public Object run() {
+						return ResourceBundle.getBundle("com.ibm.oti.locale." //$NON-NLS-1$
+								+ clName, locale);
+					}
+				});
+	}
+
+	private static final ObjectStreamField[] serialPersistentFields = {
+			new ObjectStreamField("country", String.class), //$NON-NLS-1$
+			new ObjectStreamField("hashcode", Integer.TYPE), //$NON-NLS-1$
+			new ObjectStreamField("language", String.class), //$NON-NLS-1$
+			new ObjectStreamField("variant", String.class) }; //$NON-NLS-1$
+
+	private void writeObject(ObjectOutputStream stream) throws IOException {
+		ObjectOutputStream.PutField fields = stream.putFields();
+		fields.put("country", countryCode); //$NON-NLS-1$
+		fields.put("hashcode", -1); //$NON-NLS-1$
+		fields.put("language", languageCode); //$NON-NLS-1$
+		fields.put("variant", variantCode); //$NON-NLS-1$
+		stream.writeFields();
+	}
+
+	private void readObject(ObjectInputStream stream) throws IOException,
+			ClassNotFoundException {
+		ObjectInputStream.GetField fields = stream.readFields();
+		countryCode = (String) fields.get("country", "");  //$NON-NLS-1$//$NON-NLS-2$
+		languageCode = (String) fields.get("language", "");  //$NON-NLS-1$//$NON-NLS-2$
+		variantCode = (String) fields.get("variant", "");  //$NON-NLS-1$//$NON-NLS-2$
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Map.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Map.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Map.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Map.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,238 @@
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * Map has a set of keys, each key is mapped to a single value.
+ */
+public interface Map {
+	/**
+	 * Map.Entry is a key/value mapping which is contained in a Map.
+	 * 
+	 */
+	public abstract static interface Entry {
+		/**
+		 * Compares the specified object to this Map.Entry and answer if they
+		 * are equal. The object must be an instance of Map.Entry and have the
+		 * same key and value.
+		 * 
+		 * @param object
+		 *            the object to compare with this object
+		 * @return true if the specified object is equal to this Map.Entry,
+		 *         false otherwise
+		 * 
+		 * @see #hashCode
+		 */
+		public boolean equals(Object object);
+
+		/**
+		 * Gets the key.
+		 * 
+		 * @return the key
+		 */
+		public Object getKey();
+
+		/**
+		 * Gets the value.
+		 * 
+		 * @return the value
+		 */
+		public Object getValue();
+
+		/**
+		 * Answers an integer hash code for the receiver. Objects which are
+		 * equal answer the same value for this method.
+		 * 
+		 * @return the receiver's hash
+		 * 
+		 * @see #equals
+		 */
+		public int hashCode();
+
+		/**
+		 * Sets the value.
+		 * 
+		 * @param object
+		 *            the new value
+		 * @return object
+		 */
+		public Object setValue(Object object);
+	};
+
+	/**
+	 * Removes all elements from this Map, leaving it empty.
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this Map is not supported
+	 * 
+	 * @see #isEmpty
+	 * @see #size
+	 */
+	public void clear();
+
+	/**
+	 * Searches this Map for the specified key.
+	 * 
+	 * @param key
+	 *            the object to search for
+	 * @return true if <code>key</code> is a key of this Map, false otherwise
+	 */
+	public boolean containsKey(Object key);
+
+	/**
+	 * Searches this Map for the specified value.
+	 * 
+	 * @param value
+	 *            the object to search for
+	 * @return true if <code>value</code> is a value of this Map, false
+	 *         otherwise
+	 */
+	public boolean containsValue(Object value);
+
+	/**
+	 * Returns a <code>Set</code> whose elements comprise all of the mappings
+	 * that are to be found in this <code>Map</code>. Information on each of
+	 * the mappings is encapsulated in a separate {@link Map.Entry} instance. As
+	 * the <code>Set</code> is backed by this <code>Map</code>, users
+	 * should be aware that changes in one will be immediately visible in the
+	 * other.
+	 * 
+	 * @return a <code>Set</code> of the mappings
+	 */
+	public Set entrySet();
+
+	/**
+	 * Compares the argument to the receiver, and answers true if they represent
+	 * the <em>same</em> object using a class specific comparison.
+	 * 
+	 * @param object
+	 *            Object the object to compare with this object.
+	 * @return boolean <code>true</code> if the object is the same as this
+	 *         object <code>false</code> if it is different from this object.
+	 * @see #hashCode
+	 */
+	public boolean equals(Object object);
+
+	/**
+	 * Answers the value of the mapping with the specified key.
+	 * 
+	 * @param key
+	 *            the key
+	 * @return the value of the mapping with the specified key
+	 */
+	public Object get(Object key);
+
+	/**
+	 * Answers an integer hash code for the receiver. Objects which are equal
+	 * answer the same value for this method.
+	 * 
+	 * @return the receiver's hash
+	 * 
+	 * @see #equals
+	 */
+	public int hashCode();
+
+	/**
+	 * Answers if this Map has no elements, a size of zero.
+	 * 
+	 * @return true if this Map has no elements, false otherwise
+	 * 
+	 * @see #size
+	 */
+	public boolean isEmpty();
+
+	/**
+	 * Answers a Set of the keys contained in this Map. The set is backed by
+	 * this Map so changes to one are relected by the other. The set does not
+	 * support adding.
+	 * 
+	 * @return a Set of the keys
+	 */
+	public Set keySet();
+
+	/**
+	 * Maps the specified key to the specified value.
+	 * 
+	 * @param key
+	 *            the key
+	 * @param value
+	 *            the value
+	 * @return the value of any previous mapping with the specified key or null
+	 *         if there was no mapping
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding to this Map is not supported
+	 * @exception ClassCastException
+	 *                when the class of the key or value is inappropriate for
+	 *                this Map
+	 * @exception IllegalArgumentException
+	 *                when the key or value cannot be added to this Map
+	 * @exception NullPointerException
+	 *                when the key or value is null and this Map does not
+	 *                support null keys or values
+	 */
+	public Object put(Object key, Object value);
+
+	/**
+	 * Copies every mapping in the specified Map to this Map.
+	 * 
+	 * @param map
+	 *            the Map to copy mappings from
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when adding to this Map is not supported
+	 * @exception ClassCastException
+	 *                when the class of a key or value is inappropriate for this
+	 *                Map
+	 * @exception IllegalArgumentException
+	 *                when a key or value cannot be added to this Map
+	 * @exception NullPointerException
+	 *                when a key or value is null and this Map does not support
+	 *                null keys or values
+	 */
+	public void putAll(Map map);
+
+	/**
+	 * Removes a mapping with the specified key from this Map.
+	 * 
+	 * @param key
+	 *            the key of the mapping to remove
+	 * @return the value of the removed mapping or null if key is not a key in
+	 *         this Map
+	 * 
+	 * @exception UnsupportedOperationException
+	 *                when removing from this Map is not supported
+	 */
+	public Object remove(Object key);
+
+	/**
+	 * Answers the number of elements in this Map.
+	 * 
+	 * @return the number of elements in this Map
+	 */
+	public int size();
+
+	/**
+	 * Returns all of the current <code>Map</code> values in a
+	 * <code>Collection</code>. As the returned <code>Collection</code> is
+	 * backed by this <code>Map</code>, users should be aware that changes in
+	 * one will be immediately visible in the other.
+	 * 
+	 * @return a Collection of the values
+	 */
+	public Collection values();
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MapEntry.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MapEntry.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MapEntry.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MapEntry.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,78 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * MapEntry is an internal class which provides an implementation of Map.Entry.
+ */
+class MapEntry implements Map.Entry, Cloneable {
+	
+	Object key, value;
+
+	interface Type {
+		Object get(MapEntry entry);
+	}
+
+	MapEntry(Object theKey) {
+		key = theKey;
+	}
+
+	MapEntry(Object theKey, Object theValue) {
+		key = theKey;
+		value = theValue;
+	}
+
+	public Object clone() {
+		try {
+			return super.clone();
+		} catch (CloneNotSupportedException e) {
+			return null;
+		}
+	}
+
+	public boolean equals(Object object) {
+		if (this == object)
+			return true;
+		if (object instanceof Map.Entry) {
+			Map.Entry entry = (Map.Entry) object;
+			return (key == null ? entry.getKey() == null : key.equals(entry
+					.getKey()))
+					&& (value == null ? entry.getValue() == null : value
+							.equals(entry.getValue()));
+		} else
+			return false;
+	}
+
+	public Object getKey() {
+		return key;
+	}
+
+	public Object getValue() {
+		return value;
+	}
+
+	public int hashCode() {
+		return (key == null ? 0 : key.hashCode())
+				^ (value == null ? 0 : value.hashCode());
+	}
+
+	public Object setValue(Object object) {
+		Object result = value;
+		value = object;
+		return result;
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MissingResourceException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MissingResourceException.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MissingResourceException.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/MissingResourceException.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,70 @@
+/* Copyright 1998, 2002 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * This runtime exception is thrown by ResourceBundle when a resouce bundle
+ * cannot be found or a resource is missing from a resource bundle.
+ * 
+ * @see ResourceBundle
+ */
+public class MissingResourceException extends RuntimeException {
+
+	static final long serialVersionUID = -4876345176062000401L;
+
+	String className, key;
+
+	/**
+	 * Constructs a new instance of this class with its walkback, message, the
+	 * class name of the resource bundle and the name of the missing resource.
+	 * 
+	 * @param detailMessage
+	 *            String The detail message for the exception.
+	 * @param className
+	 *            String The class name of the resource bundle.
+	 * @param resourceName
+	 *            String The name of the missing resource.
+	 */
+	public MissingResourceException(String detailMessage, String className,
+			String resourceName) {
+		super(detailMessage);
+		this.className = className;
+		key = resourceName;
+	}
+
+	/**
+	 * Answers the class name of the resource bundle from which a resource could
+	 * not be found, or in the case of a missing resource, the name of the
+	 * missing resource bundle.
+	 * 
+	 * @return String The class name of the resource bundle.
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/**
+	 * Answers the name of the missing resource, or an empty string if the
+	 * resource bundle is missing.
+	 * 
+	 * @return String The name of the missing resource.
+	 */
+	public String getKey() {
+		return key;
+	}
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/NoSuchElementException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/NoSuchElementException.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/NoSuchElementException.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/NoSuchElementException.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,48 @@
+/* Copyright 1998, 2002 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * This runtime exception is thrown when trying to retrieve an element past the
+ * end of an Enumeration, or the first or last element from an empty Vector.
+ * 
+ * @see Enumeration
+ * @see java.lang.RuntimeException
+ */
+public class NoSuchElementException extends RuntimeException {
+
+	static final long serialVersionUID = 6769829250639411880L;
+
+	/**
+	 * Constructs a new instance of this class with its walkback filled in.
+	 */
+	public NoSuchElementException() {
+		super();
+	}
+
+	/**
+	 * Constructs a new instance of this class with its walkback and message
+	 * filled in.
+	 * 
+	 * @param detailMessage
+	 *            String The detail message for the exception.
+	 */
+	public NoSuchElementException(String detailMessage) {
+		super(detailMessage);
+	}
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observable.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observable.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observable.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observable.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,127 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * Observable is used to notify a group of Observer objects when a change
+ * occurs.
+ */
+public class Observable {
+	
+	Vector observers = new Vector();
+
+	boolean changed = false;
+
+	/**
+	 * Constructs a new Observable object.
+	 */
+	public Observable() {
+		super();
+	}
+
+	/**
+	 * Adds the specified Observer to the list of observers.
+	 * 
+	 * @param observer
+	 *            the Observer to add
+	 */
+	public synchronized void addObserver(Observer observer) {
+		if (observer == null) {
+			throw new NullPointerException();
+		}
+		if (!observers.contains(observer))
+			observers.addElement(observer);
+	}
+
+	/**
+	 * Clears the changed flag for this Observable.
+	 */
+	protected synchronized void clearChanged() {
+		changed = false;
+	}
+
+	/**
+	 * Answers the number of Observers in the list of observers.
+	 * 
+	 * @return the number of observers
+	 */
+	public synchronized int countObservers() {
+		return observers.size();
+	}
+
+	/**
+	 * Removes the specified Observer from the list of observers.
+	 * 
+	 * @param observer
+	 *            the Observer to remove
+	 */
+	public synchronized void deleteObserver(Observer observer) {
+		observers.removeElement(observer);
+	}
+
+	/**
+	 * Removes all Observers from the list of observers.
+	 */
+	public synchronized void deleteObservers() {
+		observers.setSize(0);
+	}
+
+	/**
+	 * Answers the changed flag for this Observable.
+	 * 
+	 * @return true when the changed flag for this Observable is set, false
+	 *         otherwise
+	 */
+	public synchronized boolean hasChanged() {
+		return changed;
+	}
+
+	/**
+	 * If the changed flag is set, calls the <code>update()</code> method for
+	 * every Observer in the list of observers using null as the argument.
+	 * Clears the changed flag.
+	 */
+	public void notifyObservers() {
+		notifyObservers(null);
+	}
+
+	/**
+	 * If the changed flag is set, calls the <code>update()</code> method for
+	 * every Observer in the list of observers using the specified argument.
+	 * Clears the changed flag.
+	 * 
+	 * @param data
+	 *            the argument passed to update()
+	 */
+	public void notifyObservers(Object data) {
+		if (changed) {
+			// Must clone the vector in case deleteObserver is called
+			Vector clone = (Vector) observers.clone();
+			int size = clone.size();
+			for (int i = 0; i < size; i++)
+				((Observer) clone.elementAt(i)).update(this, data);
+			clearChanged();
+		}
+	}
+
+	/**
+	 * Sets the changed flag for this Observable.
+	 */
+	protected synchronized void setChanged() {
+		changed = true;
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observer.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observer.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observer.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/java/util/Observer.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,32 @@
+/* Copyright 1998, 2002 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+
+/**
+ * Observer must be implemented by objects which are added to an Observable.
+ */
+public interface Observer {
+	/*
+	 * When the specified observable object's <code>notifyObservers</code>
+	 * method is called and the observable object has changed, this method is
+	 * called.
+	 * 
+	 * @param observable the observable object @param data the data passed to
+	 * <code>notifyObservers</code>
+	 */
+	void update(Observable observable, Object data);
+}