-
Notifications
You must be signed in to change notification settings - Fork 460
AccountShippingCountryComparator
pozil edited this page Nov 14, 2024
·
5 revisions
An example implementation of the Comparator Interface In this example we show how to sort all the accounts by their country names in alphabetical order
Implements
Comparator<Account>
public order
SortOrder
No param constructor. Assigns sort order as ascending by default
public AccountShippingCountryComparator()
Constructor accepting sort order as ascending/descending. Use this constructor to control the sort order.
public AccountShippingCountryComparator(AccountShippingCountryComparator.SortOrder order)
Name | Type | Description |
---|---|---|
order | AccountShippingCountryComparator.SortOrder |
public Integer compare(Account a1, Account a2)
Name | Type | Description |
---|---|---|
a1 | Account | |
a2 | Account |
Integer
This exception class is for throwing a custom exception
Value | Description |
---|---|
ASCENDING | |
DESCENDING |