Author: mvw
Date: 2008-11-03 13:02:02-0800
New Revision: 15961
Modified:
trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java
Log:
Loosely related to issue 5420: Guarantee that the given list remains stable throughout the lifetime of this event, just like the original code with a Vector did.
Modified: trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java?view=diff&rev=15961&p1=trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java&p2=trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java&r1=15960&r2=15961
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java (original)
+++ trunk/src/argouml-app/src/org/argouml/cognitive/ToDoListEvent.java 2008-11-03 13:02:02-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -25,6 +25,7 @@
package org.argouml.cognitive;
+import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
@@ -34,7 +35,7 @@
*/
public class ToDoListEvent {
- private List<ToDoItem> items;
+ private List<ToDoItem> items = new ArrayList<ToDoItem>();
/**
* The constructor.
@@ -45,12 +46,14 @@
}
/**
- * The constructor.
+ * The constructor.
+ * Make a copy of the list to guarantee that it remains
+ * stable throughout the lifetime of this event.
*
* @param i the List of ToDoItems that were changed/added/removed
*/
public ToDoListEvent(List<ToDoItem> i) {
- items = i;
+ items.addAll(i);
}
/**
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.