Java™ Platform
Standard Ed. 6

Uses of Interface
java.util.Comparator

Packages that use Comparator
java.lang Provides classes that are fundamental to the design of the Java programming language. 
java.text Provides classes and interfaces for handling text, dates, numbers, and messages in a manner independent of natural languages. 
java.util Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array). 
java.util.concurrent Utility classes commonly useful in concurrent programming. 
javax.swing Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms. 
javax.swing.table Provides classes and interfaces for dealing with javax.swing.JTable
 

Uses of Comparator in java.lang
 

Fields in java.lang declared as Comparator
static Comparator<String> String.CASE_INSENSITIVE_ORDER
          A Comparator that orders String objects as by compareToIgnoreCase.
 

Uses of Comparator in java.text
 

Classes in java.text that implement Comparator
 class Collator
          The Collator class performs locale-sensitive String comparison.
 class RuleBasedCollator
          The RuleBasedCollator class is a concrete subclass of Collator that provides a simple, data-driven, table collator.
 

Uses of Comparator in java.util
 

Methods in java.util that return Comparator
 Comparator<? super K> TreeMap.comparator()
           
 Comparator<? super E> PriorityQueue.comparator()
          Returns the comparator used to order the elements in this queue, or null if this queue is sorted according to the natural ordering of its elements.
 Comparator<? super E> TreeSet.comparator()
           
 Comparator<? super E> SortedSet.comparator()
          Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.
 Comparator<? super K> SortedMap.comparator()
          Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.
static
<T> Comparator<T>
Collections.reverseOrder()
          Returns a comparator that imposes the reverse of the natural ordering on a collection of objects that implement the Comparable interface.
static
<T> Comparator<T>
Collections.reverseOrder(Comparator<T> cmp)
          Returns a comparator that imposes the reverse ordering of the specified comparator.
 

Methods in java.util with parameters of type Comparator
static
<T> int
Collections.binarySearch(List<? extends T> list, T key, Comparator<? super T> c)
          Searches the specified list for the specified object using the binary search algorithm.
static
<T> int
Arrays.binarySearch(T[] a, int fromIndex, int toIndex, T key, Comparator<? super T> c)
          Searches a range of the specified array for the specified object using the binary search algorithm.
static
<T> int
Arrays.binarySearch(T[] a, T key, Comparator<? super T> c)
          Searches the specified array for the specified object using the binary search algorithm.
static
<T> T
Collections.max(Collection<? extends T> coll, Comparator<? super T> comp)
          Returns the maximum element of the given collection, according to the order induced by the specified comparator.
static
<T> T
Collections.min(Collection<? extends T> coll, Comparator<? super T> comp)
          Returns the minimum element of the given collection, according to the order induced by the specified comparator.
static
<T> Comparator<T>
Collections.reverseOrder(Comparator<T> cmp)
          Returns a comparator that imposes the reverse ordering of the specified comparator.
static
<T> void
Collections.sort(List<T> list, Comparator<? super T> c)
          Sorts the specified list according to the order induced by the specified comparator.
static
<T> void
Arrays.sort(T[] a, Comparator<? super T> c)
          Sorts the specified array of objects according to the order induced by the specified comparator.
static
<T> void
Arrays.sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> c)
          Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.
 

Constructors in java.util with parameters of type Comparator
PriorityQueue(int initialCapacity, Comparator<? super E> comparator)
          Creates a PriorityQueue with the specified initial capacity that orders its elements according to the specified comparator.
TreeMap(Comparator<? super K> comparator)
          Constructs a new, empty tree map, ordered according to the given comparator.
TreeSet(Comparator<? super E> comparator)
          Constructs a new, empty tree set, sorted according to the specified comparator.
 

Uses of Comparator in java.util.concurrent
 

Methods in java.util.concurrent that return Comparator
 Comparator<? super E> PriorityBlockingQueue.comparator()
          Returns the comparator used to order the elements in this queue, or null if this queue uses the natural ordering of its elements.
 Comparator<? super E> ConcurrentSkipListSet.comparator()
           
 Comparator<? super K> ConcurrentSkipListMap.comparator()
           
 

Constructors in java.util.concurrent with parameters of type Comparator
ConcurrentSkipListMap(Comparator<? super K> comparator)
          Constructs a new, empty map, sorted according to the specified comparator.
ConcurrentSkipListSet(Comparator<? super E> comparator)
          Constructs a new, empty set that orders its elements according to the specified comparator.
PriorityBlockingQueue(int initialCapacity, Comparator<? super E> comparator)
          Creates a PriorityBlockingQueue with the specified initial capacity that orders its elements according to the specified comparator.
 

Uses of Comparator in javax.swing
 

Methods in javax.swing that return Comparator
protected  Comparator<? super Component> SortingFocusTraversalPolicy.getComparator()
          Returns the Comparator which will be used to sort the Components in a focus traversal cycle.
 Comparator<?> DefaultRowSorter.getComparator(int column)
          Returns the Comparator for the specified column.
 

Methods in javax.swing with parameters of type Comparator
protected  void SortingFocusTraversalPolicy.setComparator(Comparator<? super Component> comparator)
          Sets the Comparator which will be used to sort the Components in a focus traversal cycle.
 void DefaultRowSorter.setComparator(int column, Comparator<?> comparator)
          Sets the Comparator to use when sorting the specified column.
 

Constructors in javax.swing with parameters of type Comparator
SortingFocusTraversalPolicy(Comparator<? super Component> comparator)
          Constructs a SortingFocusTraversalPolicy with the specified Comparator.
 

Uses of Comparator in javax.swing.table
 

Methods in javax.swing.table that return Comparator
 Comparator<?> TableRowSorter.getComparator(int column)
          Returns the Comparator for the specified column.
 


Java™ Platform
Standard Ed. 6

Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.

Scripting on this page tracks web page traffic, but does not change the content in any way.