View Javadoc

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