To separate Integer and String ArrayList from Object ArrayList

I have an arraylist containing Objects. I have two different arraylists, one containing strings and the other integers. Now I need to get the strings and integers rom the parent list and put it in the new two arraylists. The arraylists are as follows.

ArrayList<Object> lDeltaAttrList = new ArrayList<Object>();
ArrayList<String> lDeltaAttrListString = new ArrayList<String>();
ArrayList<Integer> lDeltaAttrListInteger = new ArrayList<Integer>();

Please help.


You simply check if the Object is whether a String or an Integer and put it in the right list.

for(Object o : lDeltaAttrList) {
    if(o instanceof String) {
    } else if(o instanceof Integer) {

Need Your Help

Can you ever have too many “protected virtual” methods?

c# .net virtual protected

Here's a question for those of you with experience in larger projects and API/framework design.

Objective-C, changing NSButton functionality?

objective-c cocoa nsbutton

How can I change the functionality of a button that I used previously? For example, If I had a button that did "Proceed/Cancel" and let's say you "Proceed" the button would change to something such...

Binding an xml node's children to ASP.Net DropDownList

c# xml data-binding drop-down-menu

I'm trying to bind the contents of a node of XML to a Drop Down List without much success.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.