11d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert/* 21d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Copyright (C) 2011 The Guava Authors 31d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 41d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 51d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * in compliance with the License. You may obtain a copy of the License at 61d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 71d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * http://www.apache.org/licenses/LICENSE-2.0 81d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 91d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Unless required by applicable law or agreed to in writing, software distributed under the 101d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 111d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * express or implied. See the License for the specific language governing permissions and 121d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * limitations under the License. 131d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */ 141d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 151d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertpackage com.google.common.collect; 161d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 171d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport com.google.common.annotations.GwtCompatible; 181d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 191d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport java.util.Comparator; 201d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport java.util.Iterator; 211d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 221d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert/** 231d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * An {@code Iterable} whose elements are sorted relative to a {@code Comparator}, typically 241d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * provided at creation time. 251d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 261d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @author Louis Wasserman 271d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */ 281d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert@GwtCompatible 291d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertinterface SortedIterable<T> extends Iterable<T> { 301d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert /** 311d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Returns the {@code Comparator} by which the elements of this iterable are ordered, or {@code 321d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Ordering.natural()} if the elements are ordered by their natural ordering. 331d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */ 341d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert Comparator<? super T> comparator(); 351d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 361d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert /** 371d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Returns an iterator over elements of type {@code T}. The elements are returned in 381d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * nondecreasing order according to the associated {@link #comparator}. 391d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */ 401d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert @Override 411d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert Iterator<T> iterator(); 421d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert} 43