@@ -0,0 +1,2389 @@
+/* %0A * Copyright 2002-2004 The Apache Software Foundation%0A * Licensed  under the  Apache License,  Version 2.0  (the %22License%22);%0A * you may not use  this file  except in  compliance with the License.%0A * You may obtain a copy of the License at %0A * %0A *   http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed  under the  License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or%0A * implied.%0A * %0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.james.util;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0A/**%0A * Miscelaneous utilities to manipulate Lists.%0A *%0A * @deprecated use org.apache.commons.collections.ListUtils instead%0A * @author %3Ca href=%22mailto:dev@avalon.apache.org%22%3EAvalon Development Team%3C/a%3E%0A * @version CVS $Revision: 1.1 $ $Date: 2004/07/09 17:43:07 $%0A * @since 4.0%0A */%0Apublic class ListUtils%0A%7B%0A    public static List intersection( final List list1, final List list2 )%0A    %7B%0A        final ArrayList result = new ArrayList();%0A        final Iterator iterator = list2.iterator();%0A%0A        while( iterator.hasNext() )%0A        %7B%0A            final Object o = iterator.next();%0A%0A            if( list1.contains( o ) )%0A            %7B%0A                result.add( o );%0A            %7D%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A    public static List subtract( final List list1, final List list2 )%0A    %7B%0A        final ArrayList result = new ArrayList( list1 );%0A        final Iterator iterator = list2.iterator();%0A%0A        while( iterator.hasNext() )%0A        %7B%0A            result.remove( iterator.next() );%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A    public static List sum( final List list1, final List list2 )%0A    %7B%0A        return subtract( union( list1, list2 ),%0A                         intersection( list1, list2 ) );%0A    %7D%0A%0A    public static List union( final List list1, final List list2 )%0A    %7B%0A        final ArrayList result = new ArrayList( list1 );%0A%0A        final Iterator iterator = list2.iterator();%0A        while( iterator.hasNext() )%0A        %7B%0A            final Object o = iterator.next();%0A            if( !result.contains( o ) )%0A            %7B%0A                result.add( o );%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%7D%0A

Add ListUtils from excalibur-collections to the util package (this 3k source is the only usage of excalibur-collections).