Deprecating. I'd like to remove this class, if no one has any issues.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rodney Waldhoff 2001-05-16 22:19:23 +00:00
parent 284b6f5477
commit ffe28c43e0
1 changed files with 12 additions and 11 deletions

View File

@ -16,19 +16,20 @@ import java.util.List;
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @deprecated See {@link org.apache.commons.collections.CollectionUtils}.
*/
public class ListUtils
{
public static List intersection( final List list1, final List list2 )
public static List intersection( final List list1, final List list2 )
{
final ArrayList result = new ArrayList();
final Iterator iterator = list2.iterator();
while( iterator.hasNext() )
while( iterator.hasNext() )
{
final Object o = iterator.next();
if ( list1.contains( o ) )
if ( list1.contains( o ) )
{
result.add( o );
}
@ -36,27 +37,27 @@ public class ListUtils
return result;
}
public static List subtract( final List list1, final List list2 )
public static List subtract( final List list1, final List list2 )
{
final ArrayList result = new ArrayList( list1 );
final Iterator iterator = list2.iterator();
while( iterator.hasNext() )
while( iterator.hasNext() )
{
result.remove( iterator.next() );
}
return result;
}
public static List sum( final List list1, final List list2 )
public static List sum( final List list1, final List list2 )
{
return subtract( union( list1, list2 ),
return subtract( union( list1, list2 ),
intersection( list1, list2 ) );
}
public static List union( final List list1, final List list2 )
public static List union( final List list1, final List list2 )
{
final ArrayList result = new ArrayList( list1 );
result.addAll( list2 );