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