Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "extract particular elements from arraylist" Watch "extract particular elements from arraylist" New topic

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.
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

Joined: Sep 28, 2004
Posts: 19499

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.


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