code: public static Collection getLabelsFromMap(Collection sortedKeys, Map keysAndLabels)
      {
          Collection<Object> labels = new ArrayList<Object>();
          Iterator keyIt = sortedKeys.iterator();
          while (keyIt.hasNext())
          {
              labels.add(keysAndLabels.get(keyIt.next()));
          }
          return labels;
      }
docs: Will extract labels from a map in sorted order.
  
  @param sortedKeys
  collection with keys in the appropriate order. Each key
  corresponds to one in the map.
  @param keysAndLabels
  map containing both, keys and labels, from which the labels
  have to be extracted.
  @return a collection containing the labels corresponding to the
  collection of sortedKeys.