Click here to Skip to main content
14,870,069 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Why StringBuilder class in Java dont have sort sort method like other types.. Eg- Arrays.. Also why Collections.sort() method only accepts List and not any other data type? I know it cannot accept hashset as it is not ordered but why not Stringbuilder or StringBuffer.. Thanks in advance!

What I have tried:

Sort method for StringBuilder in Java
Updated 12-Mar-18 5:50am

1 solution

The StringBuilder class is used to create strings by adding smaller strings together. The idea of a sort method makes no real sense. The rest of your quesion can be answered by studying Collections (Java Platform SE 8 )[^].
CPallini 12-Mar-18 11:52am
Maciej Los 12-Mar-18 16:44pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900