Class OrderUtil


  • public class OrderUtil
    extends Object
    A utility class for the sorting of RestRole.
    • Field Detail

      • ROLE_ORDER

        public static final Comparator<discord4j.discordjson.json.RoleData> ROLE_ORDER
        The ordering of Discord roles.

        In Discord, two orderable entities may have the same "raw position," the position as reported by the "position" field. This conflict is resolved by comparing the creation time of the entities, reflected in their IDs.

    • Constructor Detail

      • OrderUtil

        public OrderUtil()
    • Method Detail

      • orderRoles

        public static Flux<discord4j.discordjson.json.RoleData> orderRoles​(Flux<discord4j.discordjson.json.RoleData> roles)
        Sorts roles according to visual ordering in Discord. Roles at the bottom of the list are first.

        sorts roles according to ROLE_ORDER.

        Parameters:
        roles - The roles to sort.
        Returns:
        The sorted roles.