ValueSequence result = new ValueSequence(); for(Iterator i = set.iterator(); i.hasNext(); ) { value = (AtomicValue)i.next();  result.add(value); } LOG.debug("distinct-values found " + result.getLength() + " in " + (System.currentTimeMillis() - start));
LOG.debug( "distinct-values found " + result.getLength() + " in " + (System.currentTimeMillis() - start));
	public Sequence eval(		Sequence contextSequence,		Item contextItem)		throws XPathException {		if(contextItem != null)			contextSequence = contextItem.toSequence();		long start = System.currentTimeMillis();		Sequence values = getArgument(0).eval(contextSequence);		TreeSet set = new TreeSet(new Comparator() {			public int compare(Object o1, Object o2) {				try {					return ((AtomicValue)o1).compareTo((AtomicValue)o2);				} catch (XPathException e) {					throw new IllegalArgumentException("cannot compare values");				}			}		});		AtomicValue value;		for(SequenceIterator i = values.iterate(); i.hasNext(); ) {			value = (AtomicValue)i.nextItem();			if(!set.contains(value))				set.add(value);		}		ValueSequence result = new ValueSequence();		for(Iterator i = set.iterator(); i.hasNext(); ) {			value = (AtomicValue)i.next();			//LOG.debug("value: " + value.getStringValue());			result.add(value);		}		LOG.debug("distinct-values found " + result.getLength() + 			" in " + (System.currentTimeMillis() - start));		return result;	}