Groovy web console

subscribe to the feed Subscribe
to this
site

sort list

Published 2 months ago by Rutger de Vries with tags sort list
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
list = ['code','type','defaultServiceDefinition','shortCode','active','descr','service','SVDF','gender','consumeAuthorization','locationTypeUsage','procedureConditionUsage','procedureGroup3Usage','ageTo','modifierUsage','procedureGroup2Usage','SVDATE','ageFrom','specialtyUsage','procedureGroup1Usage','diagnosisGroupUsage','SVFC','diagnosisGroup','diagnosisType','procedureGroup','serviceDefinitionPriority','conditionDynamicLogicProcedureGroup','claimFormType','conditionDynamicLogicDiagnosisGroup','caseDefinition','procedureGroup2','procedureGroup3','MVFC','serviceDefinitionLocationTypeList','MVDF','serviceDefinitionModifierList','serviceDefinitionSpecialtyList','serviceDefinitionConditionList']
order = ['service','code','shortCode'
,'descr'
,'type'
,'defaultServiceDefinition'
,'active'
,'claimFormType'
,'procedureGroup1Usage'
,'procedureGroup'
,'procedureGroup2Usage'
,'procedureGroup2'
,'procedureGroup3Usage'
,'procedureGroup3'
,'procedureConditionUsage'
,'conditionDynamicLogicProcedureGroup'
,'diagnosisGroupUsage'
,'diagnosisGroup'
,'conditionDynamicLogicDiagnosisGroup'
,'diagnosisType'
,'locationTypeUsage'
,'serviceDefinitionLocationTypeList'
,'modifierUsage'
,'serviceDefinitionModifierList'
,'specialtyUsage'
,'serviceDefinitionSpecialtyList'
,'caseDefinition'
,'serviceDefinitionPriority'
,'serviceDefinitionConditionList'
,'ageFrom'
,'ageTo'
,'gender'
,'consumeAuthorization'
]
remainder = (list - order).sort()
list.retainAll(order)
list.sort{order.indexOf(it)} + remainder