1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.collections.iterators;
  17. import java.util.Iterator;
  18. import org.apache.commons.collections.functors.UniquePredicate;
  19. /**
  20. * A FilterIterator which only returns "unique" Objects. Internally,
  21. * the Iterator maintains a Set of objects it has already encountered,
  22. * and duplicate Objects are skipped.
  23. *
  24. * @since Commons Collections 2.1
  25. * @version $Revision: 1.9 $ $Date: 2004/05/07 23:29:02 $
  26. *
  27. * @author Morgan Delagrange
  28. */
  29. public class UniqueFilterIterator extends FilterIterator {
  30. //-------------------------------------------------------------------------
  31. /**
  32. * Constructs a new <code>UniqueFilterIterator</code>.
  33. *
  34. * @param iterator the iterator to use
  35. */
  36. public UniqueFilterIterator( Iterator iterator ) {
  37. super(iterator, UniquePredicate.getInstance());
  38. }
  39. }