@@ -0,0 +1,714 @@
+package com.hotelsamdrooms.comparators;%0A%0Aimport com.hotelsamdrooms.DTO.HotelDto;%0A%0Aimport java.util.Comparator;%0A%0A%0Apublic class DynamicHotelComparator implements Comparator%3CHotelDto%3E %7B%0A%0A    private static int compareBy = 0;%0A%0A    public DynamicHotelComparator(int compareBy) %7B%0A        this.compareBy = compareBy;%0A    %7D%0A%0A    public DynamicHotelComparator compareBy(int compareBy) %7B%0A        this.compareBy = compareBy;%0A        return this;%0A    %7D%0A%0A    public int compare(HotelDto a, HotelDto b) %7B%0A        if (compareBy == 0) %7B%0A            return Float.compare(a.category, b.category);%0A        %7D%0A        if (compareBy == 1) %7B%0A            return Float.compare(b.category, a.category);%0A        %7D%0A        return 0;%0A    %7D%0A%0A%7D%0A

Create DynamicHotelComparator.java