1. /*
  2. * Copyright 2002-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;
  17. import java.util.Comparator;
  18. /**
  19. * Defines a type of <code>Bag</code> that maintains a sorted order among
  20. * its unique representative members.
  21. *
  22. * @since Commons Collections 2.0
  23. * @version $Revision: 1.9 $ $Date: 2004/02/18 01:15:42 $
  24. *
  25. * @author Chuck Burdick
  26. */
  27. public interface SortedBag extends Bag {
  28. /**
  29. * Returns the comparator associated with this sorted set, or null
  30. * if it uses its elements' natural ordering.
  31. *
  32. * @return the comparator in use, or null if natural ordering
  33. */
  34. public Comparator comparator();
  35. /**
  36. * Returns the first (lowest) member.
  37. *
  38. * @return the first element in the sorted bag
  39. */
  40. public Object first();
  41. /**
  42. * Returns the last (highest) member.
  43. *
  44. * @return the last element in the sorted bag
  45. */
  46. public Object last();
  47. }