[Solved] Sorting TreeMap alphabetically

Eric Berry wrote a handy class that compares Strings by human values instead of traditional machine values. Below is a modified version of it along with Object comparator (what I think you are looking for) and its testing class. An example on how to use the string comparator: Map<String,String> humanSortedMap = new TreeMap<>(new AlphaNumericStringComparator()); An … Read more

[Solved] TreeMap implementation in java returns only last element [closed]

You are using static in your parameters. This means that everytime you run they get overriden which perfectly explains why you are always getting the last element. You need to change to this: private String jobDescription; private String datasetName; private String jobName; private String responsiblePerson; solved TreeMap implementation in java returns only last element [closed]