I have list of objects and structure of the object is defined below:
class PredicateInfo {
String predicateName;
String predicateStatus;
}
Here, predicateName can be any valid string and predicateStatus can be any one of the string from these values: VERIFIED, IN_PROGRESS, UNVERIFIED, NOT_INITIATED.
Priority of these strings:
Priority 1: VERIFIED
Priority 2: IN_PROGRESS
Priority 3: UNVERIFIED
Priority 4: NOT_INITIATED
Here I have a use case where I want to sort List[PredicateInfo] based on the predicateStatus. For ex:
Input list:
List[ PredicateInfo("A", "IN_PROGRESS"), PredicateInfo("A", "VERIFIED")]
Output:
List[ PredicateInfo("A", "VERIFIED"), PredicateInfo("A", "IN_PROGRESS")]
One simple solutions is to iterate over and over to get the sorted list, I am trying to find other alternatives to achieve the same.