TreeMap.put() Problem

I am having a problem with adding different types of objects as keys to a TreeMap, although the javadoc says that the method takes two arguments of type object, I am getting a casting error when I try the following.
TreeMap matched = new TreeMap();
matched.put(new Integer(2), myObject);
I get a:
java.lang.ClassCastException: java.lang.Integer
If I do it as:
matched.put(String.valueOf(2), myObject);
it works fine.
Am I missing something here (since its 5:00pm on Friday)?

In addition to being Comparable, all the keys MUST be mutually comparable.
For example if you put in all String or all Integer keys everything would work. But if you mixed String and Integer keys in the same TreeMap, you would get the error you are getting.

Similar Messages

  • TreeMap.put(Date, String) throws ClassCastException

    Hello World!
    i have a problem with TreeMap,
    when i try to put a Key-Object and an Object-Object
    i get ClassCastException. WHY??
    Code:
    Date date = GregorianCalendar.getTime();
    TreeMap tm = new TreeMap();
    tm.put(date, new String("My String"));
    By puting into the tree i get the damn exception.
    Any ideas?
    thank,
    Sergej

    Hello World!
    i have a problem with TreeMap,
    when i try to put a Key-Object and an Object-Object
    i get ClassCastException. WHY??
    Code:
    Date date = GregorianCalendar.getTime();
    TreeMap tm = new TreeMap();
    tm.put(date, new String("My String"));
    By puting into the tree i get the damn exception.
    Any ideas?
    thank,
    SergejHi, doing the
    new String("My String")
    is not really a good idea.
    One rather useless string instance is created.
    just put the string literal put (..., "My String");
    Just had to make this comment, no offence.
    Regards,
    Stepan

  • A perplexing "put" problem... within CS6

    Dear Adobe Community,
    Recently, I have encountered a problem while trying to "put" files from my local view to the remote server using FTP. While some pages seem to upload successfully and can be seen when I open the internet browser to view my webpage, other pages seem to have content that is NOT being updated. When viewing the remote server folder, I can see that the page I have "put" looks great - it's updated and ready to go. But when I view that page in the browser, a different, older version appears.
    While "putting" the pages, the 'Background File Activity' window pops up and shows that, in fact, all the files associated with the page are being successfully transferred.
    I have downloaded the DW updates. I have deleted the browser cache. I'm stumped!
    Are there any Dreamweaver wizards out there that can help point me in the right direction?
    Thanks in advance for any help you can offer,
    Amy

    Hi Murray,
    Thank you for your response. I took a look, and I am definitely putting to the Remote Server. The weird part about the problem, is that I am able to "put" some of the pages without any difficulty and they will show up in the internet browser right away. Right now, I have one page that simply will not show up correctly in the browser. When I am viewing the pages in my Remote Server, the page in question is the most updated version and looks correct. If it looks good on the Remote Server, why do you think it isn't showing up in the internet browser as it should?
    Could this be some type of synchronizing issue? Earlier I changed the following settting... would you recommend changing it back?
    Site Setup --- Server --- Advanced --- 'unchecked box' for 'maintain synchronization information'
    Let me know what you think and, again, thanks for taking the time to reply today : )
    Amy

  • Chinese in put problem

    There is a very vired problem about Chinese in put in my Macbook Pro Retina.
    When I want to in put "的“, which should be "de", but when I type "d", the first charactor in the list is "王“, which should be "wang". This is really wired because it should not be there since "王”  begins with "w".
    Any idea how to fix this F**king problem?

    If you don't get an answer here, you might try the Chinese Mac list:
    https://groups.google.com/forum/?fromgroups#!forum/chinesemac

  • Billing out put problem

    hi gurus,
    I have a problem when creating billing out put automatically.  through condition technique .  I did it  when am looking into vf02 it is not coming automatically.  when am giving manually it is accepting.  when i saved that out put type it is saving and green singl is coming.  But it is not coming automatically.  Even though i maintained conditon records  in vv31.  still am getting this prob.  in procedure. am having conditon type that
    conditon type i assigned i proce.
    If any one know this please help.me .  he will get maximum rewards from this query.

    Hi Nag,
            I.Once again check assignments with repect to billing type.
            2.Check the communication tab in VV32 are you maintaining all parameters or not,check the storage field it should be filled with print,check medium also.
    I hope it will help you
    Regards,
    Murali.

  • XML PUBLISHER report in Excel out put problem

    Hi Experts,
    I have developed one XML report which output type is EXCEL in Oracle Application.
    I am getting some -ve value in the report so I need to do the trailing sign
    Menace for example I got a value -8645 I need to display the value like (8645).
    This functionality is working in PDF output but in EXCEL out put it is not working.
    Could any body please help me on this..
    Its Urgent .
    Thanks in Advance.

    Check this metalink notes, did you got any error..?
    Note: 364547.1 - Troubleshooting Oracle XML Publisher For The Oracle E-Business Suite
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=364547.1
    Note: 359875.1 - Cannot View Xml Publisher Report Output In Excel Format
    Note: 358296.1 - How To Produce Requests In Formats Of HTML, RTF, and Excel From XML Publisher
    Note: 850685.1 - Wrong Output Format In Xml Publisher Output
    Note: 727031.1 - XML Publisher Requests Always Get Defaulted to Output Format as PDF Whatever the Template Type is Set To
    Note: 337343.1 - Unable to View Excel Output File Created by XML Publisher
    Note: 401328.1 - Default Layout Format for XML Publisher Concurrent Request Is Always PDF
    Re: XML Publisher Server on EBS 11.5.10.2

  • Report web out put problem

    Hi:
    I used 10g forms and reports for my application. When I run a report .rdf file in form used
    web.show_document(v_parameter_string ,'_blank');
    build in function, the v_parameter_string include all parameter for server and application.
    Everything is ok and the report file appears in the browser window. But maybe the size of each row is too long, the words in the report body with font size =1 -- the smallest size of letter. So the color of words in report body part is dark gray but the title part is normal black color (words' font size is 2 or upper). This make I looking at report body very difficult in web browser. When I print the report from browser, the print out paper is good and no color different between body and title part.
    Do some people know why this gray color issue happened and how to fix it making the black color words appear in the report body.
    Thanks.
    LWU

    Hi Madhu,
    Yes, I did but out put is not coming.
    Regards,
    Pradeep Krishnamurthy

  • Out put problem in Ad hoc query reports

    Hi Gurus,
    I am tryting to generate a report through Ad hoc query in S_PH0_48000510 - Ad Hoc Query SAP/Query/HR_ADM - > Selected several options like personnel number / employee name / entry date / leaving date.
    But when we select it shows the input details but when i try for output the entry date / leaving date even the names of the employees are not reflecting.
    But the age/date of birth other fields are coming in output.
    Kindly let me know the solution to get a out put. If there is any changes need to be done in the back end. Pls advice with the path details.
    Thanks & Regards,
    Pradeep Krishnamurthy

    Hi Madhu,
    Yes, I did but out put is not coming.
    Regards,
    Pradeep Krishnamurthy

  • Out put problem

    Hi experts,
                            i have a problem with my script, my script name is  zmodify_form, my report name is zmodify and the trancation code of the script is zmodify, if i make any changes in form (allignments and formats) i can see the changes that made by me in printing test . But when i execute the tcode it shows the same existing screen. wat can i do for this?
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Sep 28, 2011 3:53 PM

    Hi,
    In Background u can get the Maximum length 250 only.
    Regards,
    Balavardhan.K

  • Put Problems

    I need help. I have a site I have had up and running for
    awhile. Yesterday, I created a new page that I needed. When I click
    put to add it to the site - I get this error - File activity
    Incomplete - 1 or more files or folders were not completed. So then
    I tried to just straight FTP the file. The error message I get when
    I try to few the page online is HTTP/1.1 404 Object Not Found.
    Nothing has been changed on my site. I have no idea what files were
    not completed and am at a total loss of what to do next. Can anyone
    help get me on the right track? I can update current pages fine (at
    least for now) but it seems I cannot create any new html pages.
    HELP!

    Can you CONNECT to the site in DW? When you connect, what
    FOLDER names do
    you see in the REMOTE side of the FILES PANEL?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "TJKay" <[email protected]> wrote in message
    news:ftfnjv$k1o$[email protected]..
    >I need help. I have a site I have had up and running for
    awhile.
    >Yesterday, I
    > created a new page that I needed. When I click put to
    add it to the
    > site - I
    > get this error - File activity Incomplete - 1 or more
    files or folders
    > were not
    > completed. So then I tried to just straight FTP the
    file. The error
    > message I
    > get when I try to few the page online is HTTP/1.1 404
    Object Not Found.
    > Nothing has been changed on my site. I have no idea what
    files were not
    > completed and am at a total loss of what to do next. Can
    anyone help get
    > me on
    > the right track? I can update current pages fine (at
    least for now) but
    > it
    > seems I cannot create any new html pages. HELP!
    >

  • Csv report out put problem

    am trying to generate delimited format report on command prompt.
    out put is to huge and it gives error . To over come this when I turned page break to yes the report will be generated successfully but the out put number of rows are being doubled.
    suppose initially I am getting 100 rows , With page break set to yes the out put in
    report csv format will be 200

    Its not possible to export data directly from 6i to excel but you can export in text file and then open it in excel it will open very easily but keep it in you mind first eliminate all report groups.
    and
    There is a trick to capture Oracle Reports output (text output) into a excel sheet.
    Basic Steps :
    1) Set the output format for the report to XML
    2) Run the report to generate output.
    3) Save the output file locally as a XML file.
    4) Open the file using MS Excel.
    5) To make it more beautiful, you may use a MS Excel Template
    and read below may be this will be helpful to u
    http://kr.forums.oracle.com/forums/thread.jspa?threadID=853876
    Reports 6i Matrix Output in Excel Format

  • A lot of FTP get/put problems using CS6

    I switched from CS5 to CS6. CS6 is using my CS5 site definitions automaticcally, FTP access etc. These project definitions are working good in CS5, so they are also good on CS6.
    But using FTP in CS6 gives me a lot of problems. It's neary unworkable sometimes. You never now when a upload succeded. You don't get an error message or a warning. Sometime you see on de FTP logs the message 'Canceled by the user'. I'm sure I never did that!.
    If you click in the 'external server' window, to open a server folder, the system doesn't respond, and doesn't open the folder.
    If you right click and say download, the systems respond, no file fouund on server.
    What I do is to use F5,  reload, then it works shortly. I can upload / downland one or two files. And the same problems are starting again.
    When the Adobe Application Manager is running in the background, downloading software or updates. Dreamweaver CS6 FTP has even more problems. I find it very irritating that you need to stop working while Adobe Application Manager is busy.
    Other people experience these strange problems?
    Pieter
    I'm using Windows XP.

    Pieter,
    Other people experience these strange problems?
    Maybe yes, but not with the exact same symptoms, I guess.
    When something doesn't work the way it should, first things first - clear your cache: http://forums.adobe.com/thread/494811
    See if that fixes it.
    AAM (Adobe Application Manager) and DW - I haven't come across with any dependancy issues so far.
    Is the upload issue happening for all sites or just one? If it is just one, can you try checking with a different site?
    The problem usually may also lie with the remote server end? Are you able to connect to the server via a 3rd party FTP - something like Filezilla? http://filezilla-project.org/
    -ST

  • Out Put Problems After Crash

    Hi I am running a newly installed LP8 following a crash to day I am having problems getting sound out
    If if I switch core audio to Built in Audio I do get sound from my internal speaker.
    I am Running a MOTU traveller and a MOTU 828 which are linked in Core audio and clocks linked by fiber .If I switch core audio to Both together or the Traveller on its own( I use the Traveller’s channels 1 and 2 to input to my monitors) I get I high pitched beeping sound which seems to lag the playing of my midi Keyboard
    I have tried various adjustments but to be honest I am just poking an hoping
    Any ideas?

    Sounds like you're already running an aggregate audio audio setup (linked in core audio). Maybe the crash wiped out the arregate device?
    Often resetting the MOTU 828 can clear up "beeping" sounds.
    Is it and 828MkII?
    If so the reset procedure is:
    - Unplug the firewire
    - press the button "setup", turn full right until "factory default"
    - push select
    - confirm with "value"
    - plug back firewire
    Might want to check the manual and see if the Traveler has
    a reset procedure as well.
    If none of the above just make sure your audio clocks are locked at the same frequency. Also, shut the Mac down, unplug all of the MOTU stuff, boot the Mac, plugin the MOTU units.
    pancenter-

  • Upload/Put problem - basic, need help

    Aloha,
    my first post here.
    I used to use Dreamweaver 8 and recently upgraded to CS3.
    For some reason now when I upload an HTML page that contains
    j pegs, or swf files only the HTML page gets put, I have to
    manually go and put each j peg or swf file. It used to
    automatically put all the content of the page, why is it not doing
    it anymore? Is there a setting I need to change in preferences?
    Any help is appreciated.
    thanks
    e~

    You can 'put' or 'check-in' files either independently or
    Shift+click (PC) linear groups or Ctrl+click (PC) randomly spaced
    files. If you have files within folders you can put/check-in an
    entire file and its contents.
    You can also automate the uploading of dependent files (which
    is probably what you had selected in Dreamweaver 8).
    Select Edit > Preferences (Windows) or Dreamweaver >
    Preferences (Macintosh).
    In the Preferences dialog box, select Site from the category
    list on the left.
    Set the options ( you want dependent files) and click OK.
    This will upload the html page and every file referenced in
    the page such as images, external scripting and css files and swfs.
    This can be an unnecessary step once you have completed the first
    upload of an html page and its contents. You might consider simply
    holding down the Alt (Windows) or Option (Macintosh) when selecting
    put/check-in if you need to upload every associated file. I prefer
    to leave the dependent file option deselected and use this method.
    Regards
    Nick Barling
    www.barkingweb.com

  • Data load and out put problem

    Hi Experts,
    Iam going through a peculiar problem.I have data flowing from R/3 to master data Info provider 0Requi. I have validated the data between R/3 and the master data info provider, it is found to be good. This data is being loaded from 0Requi to a staging write optimized DSO. there are routines in the Transformations for the DSO. when I check and compare the data, I found that out of 625 records in the Source only 599 were available in the target, and out of 599 records 17 records are duplicate and 29 records have not been populated from source to target.
    Any help to solve the issue will be highly appreciated and thanked with suitable points.
    Thanks and Regards
    SHL

    Thank you very much Jen, Full points to you.
    There was nothing in the error stack. Sy_Subrc in the routine was giving the problem. It has been rectified and the Data is loading fine in the development system.
    Now I am in another peculiar situation.
    The routines, after debugging, are working good in the development system but after transporting to Quality system for testing, they are failing there. Iam facing the same old problem there again. The transports are checked, they were done properly. The ABAPer is satisfied with the transported code. If you can then please guide me.Iam closing this thread and opening a new thread with Subject as " In different behavior of Routines"
    Thank you once again Jen. Full points assigned to you.
    Kind Regards
    SHL

Maybe you are looking for