handle null in Comparator class
it is possible to handle null pointer exception using Comparator.comparing static method. If you want to comparing loanAmount fields in your objects and you want that every not null value is greater than null you can use Comparator.nullFirst method in combination with Comparator.comparing like the below code:

Comparator.comparing(LoanAccount::getLoanAmount,
                     Comparator.nullsFirst(Comparator.naturalOrder()))


NaturalOrder is a method returning a comparator that compares Comparable objects in natural order.
You can also combine more comparators in a chain with method Comparator.thenComparing like the code below:

Comparator.comparing(LoanAccount::getLoanAmount,
                Comparator.nullsFirst(Comparator.naturalOrder()))
                .thenComparing(LoanAccount::getCreationDate, 
                Comparator.nullsFirst(Comparator.naturalOrder()))
                .compare(o1, o2);


Now you can rewrite your comparator with equal behaviour shortly:

public class LoanAccountAmountComparator implements Comparator&lt;LoanAccount&gt; {
    @Override
    public int compare(LoanAccount o1, LoanAccount o2) {
        if (o1 == null &amp;&amp; o2 == null) return 0;
        if (o1 == null) return -1;
        if (o2 == null) return 1;
        return Comparator.comparing(LoanAccount::getLoanAmount,
                Comparator.nullsFirst(Comparator.naturalOrder()))
                .thenComparing(LoanAccount::getCreationDate, 
                Comparator.nullsFirst(Comparator.naturalOrder()))
                .compare(o1, o2);
    }
}


Note: the use of class Date is discouraged, it is better if you use instead the java.time package classes for time related code.