donaldp 01/11/13 01:52:11 Modified: src/java/org/apache/avalon/excalibur/collections ListUtils.java Log: addAll( list2 ) is adding all objects of list2 into the result without checking if any of these is already in the result. If list1 and list2 have common objects, then result will have these common objects duplicated. This patch fixes that. Submitted By: Bill Kelemen <[EMAIL PROTECTED]> Revision Changes Path 1.3 +11 -2 jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/collections/ListUtils.java Index: ListUtils.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/collections/ListUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ListUtils.java 2001/08/07 10:57:04 1.2 +++ ListUtils.java 2001/11/13 09:52:11 1.3 @@ -16,7 +16,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Federico Barbieri</a> * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> - * @version CVS $Revision: 1.2 $ $Date: 2001/08/07 10:57:04 $ + * @version CVS $Revision: 1.3 $ $Date: 2001/11/13 09:52:11 $ * @since 4.0 */ public class ListUtils @@ -61,7 +61,16 @@ public static List union( final List list1, final List list2 ) { final ArrayList result = new ArrayList( list1 ); - result.addAll( list2 ); + + final Iterator iterator = list2.iterator(); + while( iterator.hasNext() ) + { + final Object o = iterator.next(); + if( !result.contains( o ) ) + { + result.add( o ); + } + } return result; } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>