class QueueDetail {

  List<QueueDetail> expandQueueDetail(boolean addDefault, int priority) {
    List<QueueDetail> queueDetails = new ArrayList<>();
    for (Entry<String, Integer> entry : getPriority().entrySet()) {
      QueueDetail cloneQueueDetail = cloneQueueDetail(entry.getKey(), entry.getValue(), true, name);
      queueDetails.add(cloneQueueDetail);
    }
    if (addDefault) {
      int defaultPriority = priority;
      if (defaultPriority == -1) {
        List<Integer> priorities = new ArrayList<>(getPriority().values());
        priorities.sort(Comparator.comparingInt(o -> o));
        defaultPriority = priorities.get(priorities.size() / 2);
      }
      Map<String, Integer> priorityMap = new HashMap<>(this.priority);
      priorityMap.put(Constants.DEFAULT_PRIORITY_KEY, defaultPriority);
      this.priority = Collections.unmodifiableMap(priorityMap);
      this.priorityGroup = name;
      queueDetails.add(this);
    }
    return queueDetails;
  }

}