Commit Graph

3 Commits

Author SHA1 Message Date
Bryce McKinlay 488d42af6f Makefile.am: Add HashSet.java and java/lang/ref classes.
* Makefile.am: Add HashSet.java and java/lang/ref classes.
	Remove BasicMapEntry.java and Bucket.java.
	* Makefile.in: Rebuilt.
	* java/util/HashMap.java: Rewritten.
	* java/util/HashSet.java: Imported from classpath.
	* java/util/WeakHashMap.java: Imported from classpath.
	* java/util/Hashtable.java: Rewritten based on new HashMap code.
	* java/util/Bucket.java: Deleted.
	* java/util/BasicMapEntry.java: Deleted.
	* java/util/Collections.java (search): Use a for-loop, not iterator
	hasNext().
	(copy): Use a for-loop. Throw an IndexOutOfBoundsException if run out
	of elements in source.
	(max): Use a for-loop.
	(min): Ditto.
	(reverse): Keep track of positions instead of using Iterator's
	nextIndex() and previousIndex().
	(shuffle(List)): Initialize defaultRandom if required using
	double-check thread safety idiom. Call two-argument shuffle method
	using defaultRandom.
	(defaultRandom): New field.
	(shuffle(List, Random)): Use a for-loop. Keep track of pos instead
	of using previousIndex() and nextIndex().
	(singletonMap(iterator)): Use a HashMap.Entry, not BasicMapEntry.
	* java/util/AbstractCollection.java (toString): Use a StringBuffer.
	* java/util/AbstractMap.java (toString): Use StringBuffer.
	* java/lang/ref/PhantomReference.java: Imported from classpath.
	* java/lang/ref/SoftReference.java: Ditto.
	* java/lang/ref/Reference.java: Ditto.
	* java/lang/ref/WeakReference.java: Ditto.
	* java/lang/ref/ReferenceQueue.java: Ditto.

From-SVN: r38183
2000-12-11 03:47:48 +00:00
Bryce McKinlay 3a73757880 AbstractCollection.java (addAll): Use size() instead of hasNext() in iterator loop.
2000-10-29  Bryce McKinlay  <bryce@albatross.co.nz>

	* java/util/AbstractCollection.java (addAll): Use size() instead of
	hasNext() in iterator loop.
	(clear): Ditto.
	(contains): Ditto. Simplify loop.
	(containsAll): Ditto.
	(remove): Ditto.
	(removeAll): Ditto.
	(retainAll): Ditto.
	(toArray): Ditto.
	(toString): Ditto. Use string concatenation operators, not
	StringBuffer.
	* java/util/AbstractList.java (addAll): Use size() instead of
	hasNext() in iterator loop.
	(equals): Ditto.
	(hashCode): Ditto.
	(indexOf): Ditto. Don't take null check outside of the loop.
	(iterator): Return an AbstractListItr instead of anonymous class.
	(lastIndexOf): Use a for loop bounded by size() instead of
	hasPrevious() in iterator loop.
	(listIterator): Return an AbstractListItr.
	(removeRange): Remove bounds checking code and docs.
	(AbstractListItr): New inner class. Code moved here from
	listIterator().
	(SubList.iterator): Removed. Use default implementation from
	AbstractList instead.
	(SubList.listIterator): As above.
	* java/util/AbstractMap.java (clear): Use a for loop bounded by size()
	instead of hasNext() in iterator loop.
	(containsValue): Ditto.
	(equals): Ditto.
	(get): Ditto.
	(put): Ditto.
	(putAll): Ditto.
	(remove): Ditto.
	(toString): Ditto. Use string concatenation operators, not
	StringBuffer.
	* java/util/AbstractSequentialList.java (addAll): Use a for loop
	bounded by size() instead of hasNext() in iterator loop.
	* java/util/AbstractSet.java (hashCode): Don't catch exception as
	part of normal execution flow. Do an explicit null check instead.
	* java/util/ArrayList.java (_iSize): Rename to `size'.
	(_arData): Rename to `data'.
	(get): Check lower bounds also. Simplify IndexOutOfBoundsException
	message.
	(remove): Ditto.
	(removeRange): Make protected. Don't check bounds.
	(add): Check lower bounds also. Simplify IndexOutOfBoundsException
	message.
	(addAll (Collection)): Use a size-bounded for loop instead of hasNext()
	check.
	(addAll (int, Collection)): Check lower bounds. Simplify exception
	string.
	(clone): Clone the data array too.
	(indexOf): Inline doesEqual().
	(lastIndexOf): Ditto.
	(clear): Don't set array data to null.
	(set): Check lower bounds. Simplify exception string.
	(toArray): Correct comment.
	(trimToSize): Don't update modCount, this is not a structural change.
	Add comment.

	* java/util/BitSet.java: Merged with classpath, new JDK 1.2 methods
	implemented.
	(toString): Declare `bit' as long, not int.
	(data): Made package-private, not private.

From-SVN: r37116
2000-10-29 05:06:10 +00:00
Tom Tromey 6c80c45e30 Jumbo patch:
* Imported beans and serialization
* Updated IA-64 port
* Miscellaneous bug fixes

From-SVN: r34028
2000-05-19 17:55:34 +00:00