Results 1 to 2 of 2
  1. #1
    computerbum is offline Member
    Join Date
    Feb 2010
    Posts
    26
    Rep Power
    0

    Default get specific arrayList from collection

    Hello everyone,


    I have a collection of arrayLists name Vehicles, Customers, Schedule.

    ArrayList[0] = Schedule

    ArrayList[1] = Vehicles

    ArrayList[2] = Customers

    What I want to do is create a loop and test to see if Vehicles is within the collection, and if Vehicles does exist, then I want to get all data from vehicles and store it to an array. How can I accomplish this?

    Java Code:
    "scheduleList"= ArrayList<E>  (id=2039)	
    	serialVersionUID= 8683452581122892189	
    		[0]= ArrayList<E>  (id=2043)	
    		[1]= ArrayList<E>  (id=2045)	
    			elementData= Object[10]  (id=2046)	
    				[0]= Vehicles  (id=2047)	
    					cid= 4	
    					make= "toyota" (id=2048)	
    					model= "camry" (id=2049)	
    					schedule= null	
    					type= "pass car 4d" (id=2053)	
    					vehicleId= "tc" (id=2054)	
    					year= 2006	
    				[1]= null	
    				[2]= null	
    				[3]= null	
    				[4]= null	
    				[5]= null	
    				[6]= null	
    				[7]= null	
    				[8]= null	
    				[9]= null	
    			modCount= 1	
    			size= 1	
    		[2]= ArrayList<E>  (id=2051)	
    			elementData= Object[10]  (id=2065)	
    				[0]= Customers  (id=2067)	
    				[1]= null	
    				[2]= null	
    				[3]= null	
    				[4]= null	
    				[5]= null	
    				[6]= null	
    				[7]= null	
    				[8]= null	
    				[9]= null	
    			modCount= 1	
    			size= 1	
    		[3]= null	
    		[4]= null	
    		[5]= null	
    		[6]= null	
    		[7]= null	
    		[8]= null	
    		[9]= null

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Read about the instanceof operator.

    P.S I wouldn't put Vehicles, Customers and Schedule in the same collection

Similar Threads

  1. Multiplying specific data within a arraylist
    By fiefa in forum New To Java
    Replies: 6
    Last Post: 02-01-2011, 09:54 AM
  2. java collection arraylist in jdk 1.4
    By jagdish_ in forum Advanced Java
    Replies: 1
    Last Post: 06-12-2010, 03:19 PM
  3. Retrieving specific objects from ArrayList
    By soketti in forum New To Java
    Replies: 49
    Last Post: 10-29-2009, 08:10 AM
  4. Replies: 4
    Last Post: 03-28-2009, 05:58 PM
  5. Help printing specific ArrayList elements
    By CirKuT in forum New To Java
    Replies: 5
    Last Post: 02-03-2009, 01:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •