Problem in printing elements of a Set element

I am using iterator to print the elements of a set as below:
Set<String> set = new HashSet<String>();
set.add("element");
Iterator it = set.iterator();
while (it.hasNext()) {
                 System.out.println(it.next() + "\n");
}The above code perfectly prints all the elements in the set.
I am facing problem when I am trying to store the value of set element in a string and print as below:
while (it.hasNext()) {
                 System.out.println(it.next() + "\n");
                 String e = (String)it.next();
System.out.println(e);
}All the elements in the set are not printed. Why is it behaving like so?

while (it.hasNext()) {
                 System.out.println(it.next() + "\n");
                 String e = (String)it.next();
System.out.println(e);
}You are calling it.next() method twice so it is printing alternate values.
try this:-
while (it.hasNext()) {
                 String e = (String)it.next();
                 System.out.println(e + "\n");
System.out.println(e);
}

Similar Messages

  • Problems with printing elements 13.

    Greeting card comes out blurry, faded and garbled.  Restarted computer and printer. Help!

    Hi cjwsjw,
    What OS/version are you running on?
    Is your printer driver up to date?
    You may also refer to blog link:  PSE11 | Photoshop Elements
    Regards,
    Sarika Behal

  • Problem with Photoshop Elements Printing

    I have been using Photoshop Elements for a couple of years now and know it pretty well.  Today while attempting to print, a strange problem came up:  After going through the protocol to make a print, just before the image prints PE does a very fast auto correction that basically ruins all the color correction I have made on the image.  How do I disable this function?

    Hi and thanks for your reply. I checked the settings under "Print", "More Options", then "Color Management" and it only has "Print Space", none of the three options that you said I should have.  Am I looking in the wrong place?
    Date: Mon, 3 Sep 2012 11:14:57 -0600
    From: [email protected]
    To: [email protected]
    Subject: Problem with Photoshop Elements Printing
        Re: Problem with Photoshop Elements Printing
        created by 99jon in Photoshop Elements - View the full discussion
      Check your color management by clicking More Options in the print dialog There are basically three options:1) Printer Manages Color2) Elements Manages color3) No color Management Make sure everything is consistent e.g. if you choose Elements manages color make sure color management is switched off in the print driver. 
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4669848#4669848
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4669848#4669848. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Elements by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Problems installation Photoshop Elements 8 on Windows 7

    I tried to install Photoshop elements 8 on my Windows 7 computer, but the installation gives a failure after a certain time. A file "...cab" is not working and may be corrupt ( exact failure code I can give, if necesary). Is there any possibility to get this file or the program Photoshop Elements 8 as download file so that I can complete the installation? Thank you in advance for your answers. 

    Hello,
    I just got the same problem already some time ago when I tried to install this programm in my computer. At that time (March 2012) the program crashed my computer, I had to reinstall all the Software completely including system software. The program I purchased in December 2011 from Amazon together with a Reflecta crystal Scan slide scanner as bundle, so I thought it will work.
    I will try to install the program from the download link you gave me, in case it does not work, what can I do next without having to buy a newer version?
    Regards
    Franz-Josef Laven
    Date: Tue, 6 Nov 2012 14:57:39 -0700
    From: [email protected]
    To: [email protected]
    Subject: Problems installation Photoshop Elements 8 on Windows 7
    Re: Problems installation Photoshop Elements 8 on Windows 7 created by Jeff A Wright in Downloading, Installing, Setting Up - View the full discussion
    You can download a fresh copy of the install files by following the directions listed at http://prodesigntools.com/direct-download-links-for-lightroom-3-and-ph otoshop-elements-8.html.
    I am curious did you have this installed previously or did you just purchase a copy of Photoshop Elements 8?
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4828039#4828039
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4828039#4828039
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4828039#4828039. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Downloading, Installing, Setting Up by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Has anyone had a problem installing PSE Elements 8.

    I have installed PSE Elements 8 from a new boxed CD onto a new Dell running Windows 7 Professional (64 Bit).
    PSE has loaded without any warnings and I get to the welcome screen OK. Organiser works fine but if I try and start Edit it just circles around back to the Edit prompt. I have tried getting in via Fix in Organiser which then advises Loading Elements workspace but then drops me back to menu.
    I have tried all the Tech Note suggestions but after hours of trying am still no further forward.
    I even downloaded and installed the trial version but I this performs in the same way.
    All suggestions welcome.  Thanks

    No luck.
    PE Editor does not open with Ctrl/Alt/Shift nothing...zilch
    Running PE Editor from this point using Open produces error message. PE Elements has stopped working - Close Program.
    Thanks anyway.
    Problem has now been escalated to senior tech team within Adobe.
    Date: Mon, 1 Mar 2010 02:47:01 -0700
    From: [email protected]
    To: [email protected]
    Subject: Has anyone had a problem installing PSE Elements 8.
    The only other suggestion is try re-setting the Editor preferences as this often fixes conflicts. You will also be able to check that this part of the application installed correctly.
    Hold down the windows key to the left of Alt and press the letter E to launch Explorer
    In the left side pane click on Computer
    In the right pane double click on Program Files, then double click Adobe, then double click Photoshop Elements 8.0
    Use the right hand  scroll bar to move down the list of files and locate Photoshop Elements Editor With one hand holding down all three keys CtrlShiftAlt right click on the Editor file in the list and select open.
    You should see a pop up box with the words Delete Adobe Photoshop Elements Settings File?
    Click on Yes
    Close down Elements and re-open it in the normal way.
    Please let us know if that works.
    >

  • JDeveloper Extension Problem with Navigator Elements

    Hi,
    I have a problem with the elements of the JDev Navigator.
    At IDE startup I want to set an overlay for the elements on the active project.
    This function is implemented in the Subversion Extension too.
    How can I access the elements of an active project in the navigator?
    It is not a problem to set an overlay with the ContextMenuListener.
    Thank you for your help.
    Greetings,
    Benjamin Oelenberg

    Please take a look at the Extension SDK sample projects. There is a sample that does exactly this.
    Install the Extension SDK from the Help --> Check for Updates dialog and after restart, say yes to installing the sample projects.

  • Printing elements of a table

    I've got the printing problem fixed but I'm trying to print elements of an array onto paper. It keeps giving me an unclosed character compiler error. Am I using the wrong method?
    class PaintCover implements Printable{
    Font fnt = new Font("Helvetica-Bold", Font.PLAIN, 12);
    public int print(Graphics g, PageFormat pf, int pageIndex)
    throws PrinterException{
    g.setFont(fnt);
    g.drawString('" + hold[0] + "'), 100, 200)");
    return Printable.PAGE_EXISTS;
    the hold field is an array field I have loaded further up in my code.

    Your reply is not polite either I might add. Since when did you become the newsgroup etiquette committee.

  • Problem with align element.

    Hi everybody,
    i have a problem with align element on my page. I explain:
    i have used into a panel page a panel group to align my element horizontal, but when i set the vertical-align on top, the element are align in middle.
    Now is......
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text tablelayout
    text text text text text text
    text text text text text text
    text text text text text text
    But i wont........
    text text text text text text tablelayout
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text
    Thanks.

    Have you tried using a panelHorizontal instead of a panelGroup?
    The components are automatically laid out horizontally and it has a Valign property that you can set to top.

  • Problem with installing Elements - from noob

    I have problems with installing Elements, it gives my an unknown mistake - I already have CS4 up and running, could this be the case?

    Chances are not very good that pse 4 will run on os x 10 6.8 unless you were upgrading from an earlier mac version that already had pse 4 installed.
    as per this:
    http://forums.adobe.com/message/4474236#4474236

  • Y have problems with Photoshop Elements 12  Bug after reinstallation complet  Impossible working ??

    Morning !
    We have many problems with PHOTOSHOP ELEMENTS 12 ?
    After installation on MAC OS X   YOSEMITE  .
    S O S !!

    Exporter vers photoshop do you receive any specific error messages?  In what way is Photoshop Elements 12 not working?

  • Problems with Photoshop Elements 11

    I have a problem with Photoshop Elements 11, which i bought last week. Installing was completed according the instructions. When I started to use the program my one year old HP-computer with Windows 8.1 informed that there a failure in the Photoshop program and the did not open.

    attach a screenshot of the error message.

  • I have encountered a problem in Premier Elements 13 when trying to open the downloaded bundle.

    I have a problem with Premier Elements 13. I am unable to open the downloaded bundle that I have just purchased. I am useing Windows 7 with a Chrome browser. After the download is completed, the files are ready, The box is ticked to launch Adobe Premier Elements 13. When the finish buttom is ticked I get a message saying that `We`ve encountered the following issues. Installer failed to initalize, please download Adobe support advisor to detect promlem. It appears that the support advisor has been discontinued. Can anybody offer any further advice.
    Many thanks
    John W  

    Without exact system info we can't tell you much, but as a start make sure you are actually running with administrative privileges and stuff isn't blocked by security tools.
    Mylenium

  • Problem with premiere elements 4.0

    i am having
    problem
    with premiere elements 4.0. it keeps on crashing and when i put pictures on the timeline it comes up black. when i try to preview it either it shows black or sometimes the picture but i cant see it to delete if i wanted to. also it gave me a message something like that adbe is running low on memory and i should be caution

    This is aimed at Premiere Pro, but may help
    Work through all of the steps (ideas) listed at http://ppro.wikia.com/wiki/Troubleshooting
    If your problem isn't fixed after you follow all of the steps, report back with ALL OF THE DETAILS asked for in the FINALLY section, the questions at the end of the troubleshooting link... most especially the codec used... see Question 1

  • PROBLEM IN COST ELEMENT-urgent

    Hi guru's
    i hv a problem wiht cost element, GL account have been created as COST ELEMENT and posted some entries into CO but all ready some entries are there in that GL account my question is how to post those line items into CO
    value points will be assigned for quit input
    regards
    Geetha

    hi,
    i am just  trying to find out a solution for this, create a clearing a/c., make a transfer postings to clearing a/c(with a dummy cost centre) and again transfer it from clearing account with appropriate cost centre to required gl account(cost element).
    hope this will sort ur issue.
    regards,
    Anand

  • I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, howev

    I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, however the arrows will move it OK.  Also I cannot drag the selection to another photo in the photo bin as before.

    Hi,
    Please refer: http://helpx.adobe.com/photoshop-elements/kb/pse-stops-responding-yosemite.html
    Thanks,
    Anwesha

Maybe you are looking for