Quote Originally Posted by keang View Post
True, but just because something is there it doesn't mean you should use it. It's good practice to use those classes that are the recommended classes and not those that are deprecated, or in this case, no longer recommended.
I agree that it shouldn't put the words into a StringBuffer but it equally should not populate the JList.

findwords(..) should do exactly what it says it does ie it should just find words and it should return the found words in either an array or collection class. A method that returns the found words is more useful than one that finds the words and populates the JList or one that finds the words and concatenates them into a StringBuffer. If you have a list/array of words you can easily populate the JList and/or create a concatenation of words, it's not so easy to go the other way.
Keang, it depends on requirements to your application and selected realization.
If you use findwords(..) only for creation JList, you may build Jlist directly. If you use findwords(..) also for other purposes, bettre to create String and parse this string.