Results 1 to 5 of 5
Thread: ArrayList questions
- 10-30-2011, 03:49 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
ArrayList questions
I have a few questions if you guys don't mind.
1) How do you store a .txt file that you would enter on the cmd line into an arraylist? (for example on the cmd line "java hello hey.txt")
2) How do you sort words into its alphabetical letter form? (ie: hello = ehllo, pops = opps, etc.)
Thanks.
-
Re: ArrayList questions
- 10-30-2011, 04:10 AM #3
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
Re: ArrayList questions
Thanks for responding. I figured out the first one. and about the 2nd one, i've been trying to figure it out for 2 days straight lol. i just can't seem to think of a logical way to do it...
-
Re: ArrayList questions
Myself, I'd convert the String to a char array, use java.util.Arrays.sort(...) method, and then convert the char array back to a String by passing it to a String constructor, 4-5 lines of code max.
- 10-30-2011, 04:53 AM #5
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
ArrayList copy some of the element from one arraylist tnto another arraylist
By ralf in forum New To JavaReplies: 12Last Post: 07-07-2011, 08:49 PM -
copying contents of an ArrayList to another ArrayList
By ankit1801 in forum New To JavaReplies: 8Last Post: 03-27-2011, 06:07 AM -
sorting arraylist based on another arraylist
By busdude in forum New To JavaReplies: 4Last Post: 02-07-2011, 11:48 AM -
how to add Arraylist filter for a jsp page showing results from a servlet-Arraylist
By alok_sharma in forum Java ServletReplies: 7Last Post: 11-22-2010, 01:26 PM -
Java Project Trouble: Searching one ArrayList with another ArrayList
By BC2210 in forum New To JavaReplies: 2Last Post: 04-21-2008, 11:43 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks