Skip to content

SortableAccount

pozil edited this page Oct 4, 2023 · 8 revisions

SortableAccount

Wrapper class around Account that provides an implementation of Comparable based on the ShippingCountry field and an 'in place' sort method.

Implemented types

Comparable

Constructors

public SortableAccount(Account account)


Fields

private accountAccount


Methods

public Integer compareTo(Object otherObject)

compares accounts based on ShippingCountry

Parameters

Param Description
otherObject object used for comparision with this instance

Returns

Type Description
Integer s 0 if objects are equal, 1 this object is "greater" than otherObject or 2 otherwise.

Throws

Exception Description
Throws SortException if an error occurs while sorting the list. For example, when comparing with an incompatible object type.

public static void sort(List<Account> accounts)

sorts a list of Account records using SortableAccount.compareTo

Parameters

Param Description
accounts list of account to sort

Classes

SortException

Exception thrown when SortableAccount.compareTo fails

Inheritance

SortException


Clone this wiki locally