문제

I searched it up but I couldn't find anything since I don't know the actual name to it. Is it possible to have a nonlexicographic order for example the Alphabet comes first before then numbers then symbols?

I know in java compareTo statement does it lexigraphic so is there a non-lexicographic order?

도움이 되었습니까?

해결책

When sorting or creating sorted collections, you can always specify your own instance of the object's Comparator. That way you can alter the ordering of objects.

다른 팁

You can write your own compareTo function for classes so you can order your objects anyway you want.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top