Sort map by value in Groovy jenkins pipeline script
问题 How to do custom sort of Map for example by value in Jekins pipeline script? This code doesn't quite work in Jenkins pipeline script: Map m =[ james :"silly boy", janny :"Crazy girl", jimmy :"funny man", georges:"massive fella" ] Map sorted = m.sort { a, b -> a.value <=> b.value } The map is still not sorted. I decided to crate a separate question with better name and tags, because many people were struggling to find an answer here: Groovy custom sort a map by value 回答1: You will have to