File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes extract particular elements from arraylist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "extract particular elements from arraylist" Watch "extract particular elements from arraylist" New topic
Author

extract particular elements from arraylist

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
I want to extract particular elements from an arraylist.
eg:
If arraylist contains elements : Rajkumar , Shashii , Hari Kumar , paters , nam kumar

I want to take elements ending with kumar i.e. Rajkumar, Hari Kumar , nam kumar
How can i do it through efficient coding
Thanx in advance
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18702
    
  40

Well, lists are not sorted -- so I don't think there is anything more efficient than to just use an iterator, and checking each string member with its endsWith() method.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: extract particular elements from arraylist