code: public static Map<String, Tag> toSortedMap(List<Tag> tags, Comparator<String> comparator) {
          Map<String, Tag> sortedMap;
          if (comparator == null)
              sortedMap = new LinkedHashMap<>();
          else
              sortedMap = new TreeMap<>(comparator);
          tags.forEach(tag -> sortedMap.put(tag.getName(), tag));
          return sortedMap;
      }
docs: Converts the global Tag list into a Map where the tag name is the key and the Tag the value.
  Either ordered or as-is, if the comparator is null.
  
  @param tags       the List of tags
  @param comparator the comparator to use.
  @return the Map of tags. Either ordered or as-is, if the comparator is null.