aspose 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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 417
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: 18139
    
  39

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
 
Similar Threads
Zip Files
Problem with date insertion in MySQL
Copying objects from one Arraylist to another Arraylist
Intersection of two lists
To extract column elements from a particular position onwards "MYSQL"