Skip to content

AccountShippingCountryComparator

msrivastav13 edited this page Nov 9, 2023 · 5 revisions

AccountShippingCountryComparator

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

Implemented types

Comparator<Account>

Constructors

public AccountShippingCountryComparator()

No param constructor. Assigns sort order as ascending by default

public AccountShippingCountryComparator(String sortOrder)

Constructor accepting sort order as ascending/descending. Use this constructor to control the sort order.

Parameters

Param Description
sortOrder

Fields

private VALID_SORT_ORDERSet<String>

private sortOrderString


Methods

public Integer compare(Account a1, Account a2)


Classes

ASCComparatorException

This exception class is for throwing a custom exception

Inheritance

ASCComparatorException


Clone this wiki locally