Create comparator from key or less function