Update licence
Update since and version tags git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60aa1d0752
commit
9340ca5e76
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/CollatingIterator.java,v 1.4 2002/12/13 11:03:42 scolebourne Exp $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2002/12/13 11:03:42 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/CollatingIterator.java,v 1.5 2003/01/15 21:45:23 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -68,6 +65,7 @@ import java.util.List;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
|
||||
/**
|
||||
* Provides an ordered iteration over the elements contained in
|
||||
* a collection of ordered {@link Iterator}s. In other words,
|
||||
|
@ -75,10 +73,11 @@ import java.util.BitSet;
|
|||
* my {@link #next} method will return the lesser of
|
||||
* <code>A.next()</code> and <code>B.next()</code>.
|
||||
*
|
||||
* @since 2.1
|
||||
* @since Commons Collections 2.1
|
||||
* @version $Revision: 1.5 $ $Date: 2003/01/15 21:45:23 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Revision: 1.4 $ $Date: 2002/12/13 11:03:42 $
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public class CollatingIterator implements Iterator {
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java,v 1.1 2002/08/15 23:13:51 pjack Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java,v 1.2 2003/01/15 21:45:23 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -64,13 +61,16 @@ import java.util.Collection;
|
|||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
|
||||
/** Adapter to make {@link Enumeration Enumeration} instances appear
|
||||
* to be {@link Iterator Iterator} instances.
|
||||
*
|
||||
* @since 1.0
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
|
||||
*/
|
||||
/**
|
||||
* Adapter to make {@link Enumeration Enumeration} instances appear
|
||||
* to be {@link Iterator Iterator} instances.
|
||||
*
|
||||
* @since Commons Collections 1.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/01/15 21:45:23 $
|
||||
*
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
|
||||
*/
|
||||
public class EnumerationIterator implements Iterator {
|
||||
|
||||
private Collection collection;
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/FilterIterator.java,v 1.1 2002/08/15 23:13:51 pjack Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/FilterIterator.java,v 1.2 2003/01/15 21:45:23 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -64,18 +61,19 @@ import java.util.Iterator;
|
|||
import java.util.NoSuchElementException;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
|
||||
|
||||
/** A Proxy {@link Iterator Iterator} which takes a {@link Predicate Predicate} instance to filter
|
||||
* out objects from an underlying {@link Iterator Iterator} instance.
|
||||
* Only objects for which the
|
||||
* specified <code>Predicate</code> evaluates to <code>true</code> are
|
||||
* returned.
|
||||
*
|
||||
* @since 1.0
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
* @author Jan Sorensen
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Proxy {@link Iterator Iterator} which takes a {@link Predicate Predicate} instance to filter
|
||||
* out objects from an underlying {@link Iterator Iterator} instance.
|
||||
* Only objects for which the
|
||||
* specified <code>Predicate</code> evaluates to <code>true</code> are
|
||||
* returned.
|
||||
*
|
||||
* @since Commons Collections 1.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/01/15 21:45:23 $
|
||||
*
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
* @author Jan Sorensen
|
||||
*/
|
||||
public class FilterIterator extends ProxyIterator {
|
||||
|
||||
/** Holds value of property predicate. */
|
||||
|
@ -88,31 +86,32 @@ public class FilterIterator extends ProxyIterator {
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>FilterIterator</Code> that will not function
|
||||
* until {@link #setIterator(Iterator) setIterator} is invoked.
|
||||
* Constructs a new <Code>FilterIterator</Code> that will not function
|
||||
* until {@link #setIterator(Iterator) setIterator} is invoked.
|
||||
*/
|
||||
public FilterIterator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>FilterIterator</Code> that will not function
|
||||
* until {@link #setPredicate(Predicate) setPredicate} is invoked.
|
||||
* Constructs a new <Code>FilterIterator</Code> that will not function
|
||||
* until {@link #setPredicate(Predicate) setPredicate} is invoked.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param iterator the iterator to use
|
||||
*/
|
||||
public FilterIterator( Iterator iterator ) {
|
||||
super( iterator );
|
||||
public FilterIterator(Iterator iterator) {
|
||||
super(iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>FilterIterator</Code> that will use the
|
||||
* given iterator and predicate.
|
||||
* Constructs a new <Code>FilterIterator</Code> that will use the
|
||||
* given iterator and predicate.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param predicate the predicate to use
|
||||
* @param iterator the iterator to use
|
||||
* @param predicate the predicate to use
|
||||
*/
|
||||
public FilterIterator( Iterator iterator, Predicate predicate ) {
|
||||
super( iterator );
|
||||
public FilterIterator(Iterator iterator, Predicate predicate) {
|
||||
super(iterator);
|
||||
this.predicate = predicate;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/FilterListIterator.java,v 1.1 2002/08/15 23:13:51 pjack Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/FilterListIterator.java,v 1.2 2003/01/15 21:45:23 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -65,17 +62,18 @@ import java.util.NoSuchElementException;
|
|||
import org.apache.commons.collections.Predicate;
|
||||
|
||||
/**
|
||||
* A proxy {@link ListIterator ListIterator} which
|
||||
* takes a {@link Predicate Predicate} instance to filter
|
||||
* out objects from an underlying <code>ListIterator</code>
|
||||
* instance. Only objects for which the specified
|
||||
* <code>Predicate</code> evaluates to <code>true</code> are
|
||||
* returned by the iterator.
|
||||
*
|
||||
* @since 2.0
|
||||
* @version $Revision: 1.1 $ $Date: 2002/08/15 23:13:51 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
* A proxy {@link ListIterator ListIterator} which
|
||||
* takes a {@link Predicate Predicate} instance to filter
|
||||
* out objects from an underlying <code>ListIterator</code>
|
||||
* instance. Only objects for which the specified
|
||||
* <code>Predicate</code> evaluates to <code>true</code> are
|
||||
* returned by the iterator.
|
||||
*
|
||||
* @since Commons Collections 2.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/01/15 21:45:23 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class FilterListIterator extends ProxyListIterator {
|
||||
|
||||
// Constructors
|
||||
|
@ -88,23 +86,24 @@ public class FilterListIterator extends ProxyListIterator {
|
|||
* and {@link #setPredicate(Predicate) setPredicate} are invoked.
|
||||
*/
|
||||
public FilterListIterator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>FilterListIterator</Code> that will not
|
||||
* function until {@link #setPredicate(Predicate) setPredicate} is invoked.
|
||||
* Constructs a new <Code>FilterListIterator</Code> that will not
|
||||
* function until {@link #setPredicate(Predicate) setPredicate} is invoked.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param iterator the iterator to use
|
||||
*/
|
||||
public FilterListIterator(ListIterator iterator ) {
|
||||
super(iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>FilterListIterator</Code>.
|
||||
* Constructs a new <Code>FilterListIterator</Code>.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param predicate the predicate to use
|
||||
* @param iterator the iterator to use
|
||||
* @param predicate the predicate to use
|
||||
*/
|
||||
public FilterListIterator(ListIterator iterator, Predicate predicate) {
|
||||
super(iterator);
|
||||
|
@ -112,14 +111,15 @@ public class FilterListIterator extends ProxyListIterator {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>FilterListIterator</Code> that will not
|
||||
* function until
|
||||
* {@link ProxyListIterator#setListIterator(ListIterator) setListIterator}
|
||||
* is invoked.
|
||||
* Constructs a new <Code>FilterListIterator</Code> that will not
|
||||
* function until
|
||||
* {@link ProxyListIterator#setListIterator(ListIterator) setListIterator}
|
||||
* is invoked.
|
||||
*
|
||||
* @param predicate the predicate to use.
|
||||
* @param predicate the predicate to use.
|
||||
*/
|
||||
public FilterListIterator(Predicate predicate) {
|
||||
super();
|
||||
this.predicate = predicate;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/IteratorChain.java,v 1.3 2002/10/31 21:55:23 rwaldhoff Exp $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2002/10/31 21:55:23 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/IteratorChain.java,v 1.4 2003/01/15 21:46:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -85,10 +82,11 @@ import java.util.NoSuchElementException;
|
|||
* UnsupportedOperationException. Subclasses should <i>take care</i>
|
||||
* to not alter the underlying List of Iterators.</p>
|
||||
*
|
||||
* @since 2.1
|
||||
* @since Commons Collections 2.1
|
||||
* @version $Revision: 1.4 $ $Date: 2003/01/15 21:46:55 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Id: IteratorChain.java,v 1.3 2002/10/31 21:55:23 rwaldhoff Exp $
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public class IteratorChain implements Iterator {
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java,v 1.1 2002/08/15 23:13:51 pjack Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java,v 1.2 2003/01/15 21:46:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -63,31 +60,35 @@ package org.apache.commons.collections.iterators;
|
|||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
|
||||
/** Adapter to make an {@link Iterator Iterator} instance appear to be an {@link Enumeration Enumeration} instances
|
||||
*
|
||||
* @since 1.0
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adapter to make an {@link Iterator Iterator} instance appear to be an {@link Enumeration Enumeration} instances
|
||||
*
|
||||
* @since Commons Collections 1.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/01/15 21:46:55 $
|
||||
*
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
*/
|
||||
public class IteratorEnumeration implements Enumeration {
|
||||
|
||||
private Iterator iterator;
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>IteratorEnumeration</Code> that will not
|
||||
* function until {@link #setIterator(Iterator) setIterator} is
|
||||
* invoked.
|
||||
* Constructs a new <Code>IteratorEnumeration</Code> that will not
|
||||
* function until {@link #setIterator(Iterator) setIterator} is
|
||||
* invoked.
|
||||
*/
|
||||
public IteratorEnumeration() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>IteratorEnumeration</Code> that will use
|
||||
* the given iterator.
|
||||
* Constructs a new <Code>IteratorEnumeration</Code> that will use
|
||||
* the given iterator.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param iterator the iterator to use
|
||||
*/
|
||||
public IteratorEnumeration( Iterator iterator ) {
|
||||
super();
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java,v 1.2 2002/08/17 11:33:09 scolebourne Exp $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2002/08/17 11:33:09 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java,v 1.3 2003/01/15 21:46:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -64,15 +61,17 @@ import java.util.Iterator;
|
|||
import java.util.LinkedList;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* As the wrapped Iterator is traversed, ListIteratorWrapper
|
||||
* builds a LinkedList of its values, permitting all required
|
||||
* operations of ListIterator.
|
||||
*
|
||||
* @since 2.1
|
||||
* @since Commons Collections 2.1
|
||||
* @version $Revision: 1.3 $ $Date: 2003/01/15 21:46:55 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Id: ListIteratorWrapper.java,v 1.2 2002/08/17 11:33:09 scolebourne Exp $
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public class ListIteratorWrapper implements ListIterator {
|
||||
|
||||
|
@ -100,6 +99,7 @@ public class ListIteratorWrapper implements ListIterator {
|
|||
* @throws NullPointerException if the iterator is null
|
||||
*/
|
||||
public ListIteratorWrapper(Iterator iterator) {
|
||||
super();
|
||||
if (iterator == null) {
|
||||
throw new NullPointerException("Iterator must not be null");
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ProxyIterator.java,v 1.1 2002/08/15 23:13:51 pjack Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ProxyIterator.java,v 1.2 2003/01/15 21:49:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -62,34 +59,39 @@ package org.apache.commons.collections.iterators;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
/** A Proxy {@link Iterator Iterator} which delegates its methods to a proxy instance.
|
||||
*
|
||||
* @since 1.0
|
||||
* @see ProxyListIterator
|
||||
* @version $Revision: 1.1 $ $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Proxy {@link Iterator Iterator} which delegates its methods to a proxy instance.
|
||||
*
|
||||
* @see ProxyListIterator
|
||||
* @since Commons Collections 1.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/01/15 21:49:14 $
|
||||
*
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
*/
|
||||
public class ProxyIterator implements Iterator {
|
||||
|
||||
/** Holds value of property iterator. */
|
||||
private Iterator iterator;
|
||||
|
||||
// Constructors
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>ProxyIterator</Code> that will not function
|
||||
* until {@link #setIterator(Iterator)} is called.
|
||||
* Constructs a new <Code>ProxyIterator</Code> that will not function
|
||||
* until {@link #setIterator(Iterator)} is called.
|
||||
*/
|
||||
public ProxyIterator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>ProxyIterator</Code> that will use the
|
||||
* given iterator.
|
||||
* Constructs a new <Code>ProxyIterator</Code> that will use the
|
||||
* given iterator.
|
||||
*
|
||||
* @param iterator the underyling iterator
|
||||
* @param iterator the underyling iterator
|
||||
*/
|
||||
public ProxyIterator( Iterator iterator ) {
|
||||
public ProxyIterator(Iterator iterator) {
|
||||
super();
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ProxyListIterator.java,v 1.1 2002/08/15 23:13:51 pjack Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/08/15 23:13:51 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ProxyListIterator.java,v 1.2 2003/01/15 21:49:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -66,31 +63,37 @@ import java.util.ListIterator;
|
|||
* A proxy {@link ListIterator ListIterator} which delegates its
|
||||
* methods to a proxy instance.
|
||||
*
|
||||
* @since 2.0
|
||||
* @see ProxyIterator
|
||||
* @version $Revision: 1.1 $ $Date: 2002/08/15 23:13:51 $
|
||||
* @since Commons Collections 2.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/01/15 21:49:14 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class ProxyListIterator implements ListIterator {
|
||||
|
||||
// Constructor
|
||||
/** Holds value of property "iterator". */
|
||||
private ListIterator iterator;
|
||||
|
||||
// Constructors
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>ProxyListIterator</Code> that will not
|
||||
* function until {@link #setListIterator(ListIterator) setListIterator}
|
||||
* is invoked.
|
||||
* Constructs a new <Code>ProxyListIterator</Code> that will not
|
||||
* function until {@link #setListIterator(ListIterator) setListIterator}
|
||||
* is invoked.
|
||||
*/
|
||||
public ProxyListIterator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>ProxyListIterator</Code> that will use the
|
||||
* given list iterator.
|
||||
* Constructs a new <Code>ProxyListIterator</Code> that will use the
|
||||
* given list iterator.
|
||||
*
|
||||
* @param iterator the list iterator to use
|
||||
* @param iterator the list iterator to use
|
||||
*/
|
||||
public ProxyListIterator(ListIterator iterator) {
|
||||
super();
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
|
@ -197,11 +200,5 @@ public class ProxyListIterator implements ListIterator {
|
|||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
// Attributes
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/** Holds value of property "iterator". */
|
||||
private ListIterator iterator;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/TransformIterator.java,v 1.2 2002/10/12 22:15:21 scolebourne Exp $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2002/10/12 22:15:21 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/TransformIterator.java,v 1.3 2003/01/15 21:49:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -63,13 +60,16 @@ package org.apache.commons.collections.iterators;
|
|||
import java.util.Iterator;
|
||||
import org.apache.commons.collections.Transformer;
|
||||
|
||||
/** A Proxy {@link Iterator Iterator} which uses a {@link Transformer Transformer} instance to
|
||||
* transform the contents of the {@link Iterator Iterator} into some other form
|
||||
*
|
||||
* @since 1.0
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Proxy {@link Iterator Iterator} which uses a {@link Transformer Transformer}
|
||||
* instance to transform the contents of the {@link Iterator Iterator} into
|
||||
* some other form.
|
||||
*
|
||||
* @since Commons Collections 1.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/01/15 21:49:14 $
|
||||
*
|
||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||
*/
|
||||
public class TransformIterator extends ProxyIterator {
|
||||
|
||||
/** Holds value of property transformer. */
|
||||
|
@ -77,33 +77,34 @@ public class TransformIterator extends ProxyIterator {
|
|||
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>TransformIterator</Code> that will not function
|
||||
* until the {@link #setIterator(Iterator) setIterator} method is
|
||||
* invoked.
|
||||
* Constructs a new <Code>TransformIterator</Code> that will not function
|
||||
* until the {@link #setIterator(Iterator) setIterator} method is
|
||||
* invoked.
|
||||
*/
|
||||
public TransformIterator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>TransformIterator</Code> that won't transform
|
||||
* elements from the given iterator.
|
||||
* Constructs a new <Code>TransformIterator</Code> that won't transform
|
||||
* elements from the given iterator.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param iterator the iterator to use
|
||||
*/
|
||||
public TransformIterator( Iterator iterator ) {
|
||||
super( iterator );
|
||||
public TransformIterator(Iterator iterator) {
|
||||
super(iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <Code>TransformIterator</Code> that will use the
|
||||
* given iterator and transformer. If the given transformer is null,
|
||||
* then objects will not be transformed.
|
||||
* Constructs a new <Code>TransformIterator</Code> that will use the
|
||||
* given iterator and transformer. If the given transformer is null,
|
||||
* then objects will not be transformed.
|
||||
*
|
||||
* @param iterator the iterator to use
|
||||
* @param transformer the transformer to use
|
||||
* @param iterator the iterator to use
|
||||
* @param transformer the transformer to use
|
||||
*/
|
||||
public TransformIterator( Iterator iterator, Transformer transformer ) {
|
||||
super( iterator );
|
||||
public TransformIterator(Iterator iterator, Transformer transformer) {
|
||||
super(iterator);
|
||||
this.transformer = transformer;
|
||||
}
|
||||
|
||||
|
@ -115,13 +116,18 @@ public class TransformIterator extends ProxyIterator {
|
|||
|
||||
// Properties
|
||||
//-------------------------------------------------------------------------
|
||||
/** Getter for property transformer.
|
||||
/**
|
||||
* Getter for property transformer.
|
||||
*
|
||||
* @return Value of property transformer.
|
||||
*/
|
||||
public Transformer getTransformer() {
|
||||
return transformer;
|
||||
}
|
||||
/** Setter for property transformer.
|
||||
|
||||
/**
|
||||
* Setter for property transformer.
|
||||
*
|
||||
* @param transformer New value of property transformer.
|
||||
*/
|
||||
public void setTransformer(Transformer transformer) {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java,v 1.2 2002/10/12 22:15:21 scolebourne Exp $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2002/10/12 22:15:21 $
|
||||
*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java,v 1.3 2003/01/15 21:49:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -23,11 +20,11 @@
|
|||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
|
@ -36,7 +33,7 @@
|
|||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
@ -64,15 +61,16 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
|
||||
/** A FilterIterator which only returns "unique" Objects. Internally,
|
||||
* the Iterator maintains a Set of objects it has already encountered,
|
||||
* and duplicate Objects are skipped.
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @version $Id: UniqueFilterIterator.java,v 1.2 2002/10/12 22:15:21 scolebourne Exp $
|
||||
* @since 2.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* A FilterIterator which only returns "unique" Objects. Internally,
|
||||
* the Iterator maintains a Set of objects it has already encountered,
|
||||
* and duplicate Objects are skipped.
|
||||
*
|
||||
* @since Commons Collections 2.1
|
||||
* @version $Revision: 1.3 $ $Date: 2003/01/15 21:49:14 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
*/
|
||||
public class UniqueFilterIterator extends FilterIterator {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -86,14 +84,15 @@ public class UniqueFilterIterator extends FilterIterator {
|
|||
super( iterator, new UniquePredicate() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Private Predicate needed to implement the unique behaviour.
|
||||
*/
|
||||
private static class UniquePredicate implements Predicate {
|
||||
|
||||
HashSet set = new HashSet();
|
||||
|
||||
public boolean evaluate(Object object) {
|
||||
return set.add(object);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue