org.eclipse.wst.jsdt.ui.text.java

## Class CompletionProposalComparator

- java.lang.Object
- - org.eclipse.wst.jsdt.ui.text.java.CompletionProposalComparator

All Implemented Interfaces:
  java.util.Comparator

    public final class CompletionProposalComparator
    extends java.lang.Object
    implements java.util.Comparator

Comparator for JavaScript completion proposals. Completion proposals can be sorted by relevance or alphabetically.

Note: this comparator imposes orderings that are inconsistent with equals.

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

### Constructor Summary

Constructors
Constructor and Description
`CompletionProposalComparator()` Creates a comparator that sorts by relevance.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compare(java.lang.Object o1, java.lang.Object o2)`
`void` `setOrderAlphabetically(boolean orderAlphabetically)` Sets the sort order.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Constructor Detail

#### CompletionProposalComparator

    public CompletionProposalComparator()

Creates a comparator that sorts by relevance.

### Method Detail

#### setOrderAlphabetically

    public void setOrderAlphabetically(boolean orderAlphabetically)

Sets the sort order. Default is `false`, i.e. order by relevance.

Parameters:
  `orderAlphabetically` - `true` to order alphabetically, `false` to order by relevance

#### compare

    public int compare(java.lang.Object o1,
                       java.lang.Object o2)

Specified by:
  `compare` in interface `java.util.Comparator`