Can Comparator be Passed to ArrayList?

Sorting ArrayList objects in Java often requires custom logic beyond the natural ordering provided by the Comparable interface. This is where the Comparator interface comes into play. But can a…