Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

hlp me

Thread view: 
karthika - 04 Jul 2006 13:00 GMT
i have two things one is vector (vec) and a map ( map ) and the code
will be
for ( int i = 0;i<vec.size() ;i++ )
{
      Class obj = ( Class )vec.get( i );
      for ( Iterator it = map.keySet().iterator();it.hasNext();)
      {
                  key = (String)it.next();
                  Class2 obj2 = ( Class2 )map.get( key );
                  if (!info.contains(obj2))
                  {
                                v1.add(obj);
                   }
                   else
                    v1.remove(obj);
               }
      }
}

here what would be the result.  becoz i get the answers as a repeated
one.
Pleease help :-(
Timo Stamm - 04 Jul 2006 13:47 GMT
karthika schrieb:
> i have two things one is vector (vec) and a map ( map ) and the code
> will be

The code is incomplete. You have a reference to "info" that is never
declared or explained anywhere.

What do you want to achieve?

Timo
karthi - 05 Jul 2006 07:52 GMT
> karthika schrieb:
> > i have two things one is vector (vec) and a map ( map ) and the code
[quoted text clipped - 6 lines]
>
> Timo

Sorry Timo,
      Its not "info" The corrected code will be
for ( int i = 0;i<vec.size() ;i++ )
{
      Class obj = ( Class )vec.get( i );
      for ( Iterator it = map.keySet().iterator();it.hasNext();)
      {
                  key = (String)it.next();
                  Class2 obj2 = ( Class2 )map.get( key );
                  if (!vec.contains(obj2))
                  {
                                v1.add(obj);
                   }
                   else
                    v1.remove(obj);
               }
      }

}
Timo Stamm - 05 Jul 2006 15:21 GMT
karthi schrieb:
>> karthika schrieb:
>>> i have two things one is vector (vec) and a map ( map ) and the code
[quoted text clipped - 25 lines]
>
> }

Sorry, I still don't know what you want to achieve.

You should explain what you want to do, and where your program fails. It
also would help (us _and_ you) to use meaningful variable names.

Timo
Oliver Wong - 04 Jul 2006 15:30 GMT
>i have two things one is vector (vec) and a map ( map ) and the code
> will be
[quoted text clipped - 18 lines]
> one.
> Pleease help :-(

   Is your question "What output would this code produce?"? If so, why
don't you simply run it and see?

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.