SortedSet result = new TreeSet();
Map.Entry me;
Integer ID;
ExtendedServiceInformation inInfo,outInfo;
DOM degree;
Iterator iter = input.entrySet().iterator();
while (iter.hasNext()) {
me = (Map.Entry) iter.next();
ID = (Integer)me.getKey();
if (output.containsKey(ID)) {
inInfo=(ExtendedServiceInformation) me.getValue();
degree = ((DOM) output.get(ID));
outInfo=degree.getBestDegree();
if ( (inInfo.degreeOfMatch>outInfo.degreeOfMatch) ||
( (inInfo.degreeOfMatch==outInfo.degreeOfMatch) &&
(inInfo.similarity<outInfo.similarity) ) )
result.add(new MatchingResult(inInfo , inInfo.unfoldedconcept, outInfo.unfoldedconcept) );
else