TreeSet.java (writeObject): Use a for-loop instead of Iterator.hasNext().
2001-03-06 Bryce McKinlay <bryce@albatross.co.nz> * java/util/TreeSet.java (writeObject): Use a for-loop instead of Iterator.hasNext(). 2001-03-05 Jochen Hoenicke <jochen@gnu.org> * java/util/TreeMap.java (writeObject): Use defaultWriteObject() instead of the new JDK1.2 API. This is simpler and makes back-porting the classes to JDK1.1 trivial. (readObject): likewise. From-SVN: r40252
This commit is contained in:
parent
d97b75bee3
commit
5c409ad3d8
3 changed files with 18 additions and 12 deletions
|
@ -44,8 +44,6 @@ import java.io.ObjectOutputStream;
|
|||
* TreeSet is a part of the JDK1.2 Collections API.
|
||||
*
|
||||
* @author Jon Zeppieri
|
||||
* @version $Revision: 1.2 $
|
||||
* @modified $Id: TreeSet.java,v 1.2 2001/02/15 03:59:57 bryce Exp $
|
||||
*/
|
||||
|
||||
public class TreeSet extends AbstractSet
|
||||
|
@ -269,11 +267,12 @@ public class TreeSet extends AbstractSet
|
|||
private void writeObject(ObjectOutputStream out) throws IOException
|
||||
{
|
||||
Iterator itr = map.keySet().iterator();
|
||||
int size = map.size();
|
||||
|
||||
out.writeObject(map.comparator());
|
||||
out.writeInt(map.size());
|
||||
out.writeInt(size);
|
||||
|
||||
while (itr.hasNext())
|
||||
for (int i = 0; i < size; i++)
|
||||
out.writeObject(itr.next());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue