Server side javascript, treemap, comparator

Hello, i am a bit stuck with server side javascript. I try to write a comparator for a java.util.TreeMap and i wonder what i am doing wrong.My code bases on Julian Buss concept for sorting a FTSearch in XPages (look here: http://www.youatnotes.de/download/ynnotesview.rtf). The base system is working fine for text - now i want to sort numeric keys.

Every time i put my own comparator as argument for the treemap constructor an exception is raised.

It seems to me as if calling the comparator fails - a debug output in the comparator never shows in the server console.

Is there any example or help for that problem?