Code gives error supposed to compare pairs

question is
Expand Pair.java by testing it with at least 4 more differing Pair combinations (both primitives & classes). Find (or write) at least one other set of Pair that you can compare without altering the comparePairs method.
public class Pair<K, V> {
  K key;
  V value;
  public void set(K k, V v) {
    key = k;
    value = v;
  public K getKey() { return key; }
  public V getValue() { return value; }
  public String toString() {
    return "[" + getKey() + ", " + getValue() + "]";
  // Comparing Pairs - Slide 34
  public static <K extends Comparable,V,L,W> int
      comparePairs(Pair<K,V> p, Pair<L,W> q) {
    return p.getKey().compareTo(q.getKey());
    // p's key MUST implement compareTo
  /* IMPORTANT: This is very flexible code BUT it does
   *            allow for compilation of Pair objects that
   *            are not compatible. Safer to use only K,V.
   *            Test it below!
  public static void main (String[] args) {
    Pair<String,Integer> pair1 = new  Pair<String,Integer>();
    pair1.set(new String("a"), new Integer(36));
    System.out.println(pair1);
    Pair<Student,Double> pair2 = new  Pair<Student,Double>();
    pair2.set(new Student("A5976","Sue",19), new Double(9.5));
    System.out.println(pair2);
    Pair<String,Integer> pair3 = new  Pair<String,Integer>();
    pair3.set(new String("b"), new Integer(63));
    System.out.println(pair3);
    ///this is what i have added
    Pair<String,Student> pair4 = new  Pair<String,Student>();
    pair4.set(new String("c"), new Student("A9874","Jack",20));
    System.out.println(pair4);
    Pair<Integer,Student> pair5 = new  Pair<Integer,Student>();
    pair5.set(new Integer(3), new Student("A9471","Bal",20));
    System.out.println(pair5);
    Pair<String,Student> pair6 = new  Pair<Integer,Double>();
    pair6.set(new Integer(7), new Double(4.5));
    System.out.println(pair6);
    Pair<String,Student> pair7 = new  Pair<Double,String>();
    pair7.set(new Double(6.9),(new String("g"));
    System.out.println(pair7);
    // The comparison will be of the "String" keys AND
    // String implements the Comparable interface
    System.out.println(comparePairs(pair1, pair7)); // works; displays -1 because a < b
    // System.out.println(comparePairs(pair2, pair1)); // doesn't work BUT
    // there will ONLY be a compiler error if <K extends Comparable, V> is used
    // in the comparePairs declaration.
}

885018 wrote:
--------------------Configuration: <Default>--------------------
java.lang.NoClassDefFoundError: Pair
Caused by: java.lang.ClassNotFoundException: Pair
     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: Pair. Program will exit.
Exception in thread "main"
Process completed.The code you posted doesn't compile at all. What happened when you ran javac?

Similar Messages

  • Select query gives error in Code inspector and extended program check

    Hi,
    I have a query .
    SELECT pernr
      FROM pa9100
      INTO TABLE t_nca_tab
      WHERE endda EQ c_date AND
      z_nca_required EQ c_yes.
    This query gives me an error in Code inspector like :
    Large table pa0001: No first field of table index in WHERE  condition
    I have one more query that gives error in extended program check
    SELECT SINGLE stell ename
          INTO (g_stell, g_name)
          FROM pa0001
          WHERE pernr EQ wa_nca_tab-pernr AND
                endda EQ c_date.
    The warning says:
    *In "SELECT SINGLE ...", the WHERE condition for the key field "SEQNR" does not
    test for equality. Therefore, the single record in question may not be unique.*
    Its too urgent.
    Please reply.
    Regards,
    Binay.

    The first field is PERNR .. so if UR not giving pernr it will fetch
    all the data from the said table and between the given dates ..
    Check if this is your requirement ...
    write the select as ...
    where r_pernr is a range ...
    SELECT pernr
    FROM pa9100
    INTO TABLE t_nca_tab
    WHERE pernr in r_pernr  <----
                 endda EQ c_date AND
                 z_nca_required EQ c_yes.
    As UR using select single it's expecting to use all the key
    fields in the where condition ...
    U can ignore this warning message

  • I own acrobat 9 pro and had to re-download the program from a computer issue but when i get the serial code from the adobe website it give me serial code invalid error.  i am using copy and paste to prevent miss typing the code.

    i own acrobat 9 pro and had to re-download the program from a computer issue but when i get the serial code from the adobe website it give me serial code invalid error.  i am using copy and paste to prevent miss typing the code.

    Hi Lawrence,
    Please try the steps mentioned in the KB: https://helpx.adobe.com/creative-suite/kb/error-invalid-serial-number-acrobat.html
    Regards,
    Rave

  • ITunes gives error code -54 when sync with my iphone 5

    iTunes gives error code (-54) when i try to sync with my iphone5

    I am having the same issue. Since updating to iTunes 11 my iPhone 5 will no longer wirelessly sync. I am operating the latest version of Mountain Lion on a two month old Macbook Pro. When I plug in the USB I go through the steps of making sure the box is clicked to Wireslly sync, but after a few minutes of un-plugging the cord my phone dissapears from my devices. It tries to locate it, but cannot.
    Furthermore, when I launched iTunes 11 for the first time my phone was synced, but since I accidenttly hit the eject button in the top right, this button has yet to come back. Even when the iPhone is linked via USB. Am I Crazy, stupid, or is this a bug?
    BTW, how did MrTrav15 have this problem on 10/17 a month-and-a-half before the launching of iTunes 11?

  • My code not give error nut not give pdf report output

    hi master
    sir see my code not give error nut not give pdf report output
    String reportSource = "./WEB-INF/reports/mfa.jasper";
    String reportDest = "./reports/mfa1.html";
    Connection conn = null ;
    Statement msqlStatement = null ;
    ResultSet mrs = null ;
    Connection mconn = null ;
    ExternalContext econtext = getExternalContext();
    InputStream stream = econtext.getResourceAsStream(reportSource);
    if (stream == null) {
    throw new IllegalArgumentException("Unknown report name '" + reportSource
    + "' requested");
    try {
    String mfat = ac_categoryDataProvider.getCachedRowSet().getDataSourceName();
    javax.naming.Context mctx = new javax.naming.InitialContext() ;
    DataSource mds = (DataSource)mctx.lookup(mfat);
    Connection mcon= mds.getConnection();
    mcon.setAutoCommit(false) ;
    JasperPrint jasperPrint = null;
    //getSessionBean1().getTripRowSet(),
    //getSessionBean1().getAc_categoryRowSet(), mfat getSessionBean1().getAc_categoryRowSet()
    jasperPrint = JasperFillManager.fillReport(stream, null,mcon);
    JRExporter exporter = null;
    HttpServletResponse response = (HttpServletResponse)econtext.getResponse();
    FacesContext fcontext = FacesContext.getCurrentInstance();
    exporter = new JRPdfExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,
    response.getOutputStream());
    exporter.exportReport();
    fcontext.responseComplete();
    } catch (Exception ex) {
    log(" Error Description" , ex);
    error("Error counting rows: " + ex.getMessage() );
    error("Error counting rows: " + ex );
    please give me idea
    thank's
    aamir

    Thanks Sven.
    The query works but the other way. The output is for all the targets, not for the respective target which we select from :p1_target.
    select target_name,target_type, column_label,
    warning_threshold,critical_threshold,occurrence_count
    from sysman.MGMT$TARGET_METRIC_SETTINGS@crmodem
    where target_name in (select MEMBER_TARGET_NAME from MGMT$TARGET_FLAT_MEMBERS@crmodem
    where upper(AGGREGATE_TARGET_NAME) like '%X' || :P1_TARGET || '%')
    Thanks again.

  • Hp g70-467cl: the ts-l633m DVD gives a code 39 error, I need a replacement driver to correct this

    I have a HP G70-467CL Notebook PC Computer and I'm getting a (Code 39) error on the TSST corp CDDVDW TS-L633M ATA Device I'm running Windows Vista 64-bit Operating System the error says it is missing or has a corrupted driver issue. and when I checked for a solution nothing came up. Can anyone help me obtain the correct needed device driver? the only device drivers I could locate were for sound, display, chipset, modem, and LAN. I have already exhausted the available troubleshooters onsite HP and Microsoft. Thank you all.

    Have you ran "Windows Update"? It can sometimes locate drivers for the hardware that is installed. If that doesn't work for you, let me know and I will see if I can find anything for you.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • Adobe XI Pro trial verison, when compared two pdf files it gives error  "Expected a Name Object"..Can some one say how to fix this?

    Installed Adobe XI Pro trial verison, when compared two pdf files it gives error  "Expected a Name Object"..Can some one say how to fix this?

    Installed Adobe XI Pro trial verison, when compared two pdf files it gives error  "Expected a Name Object"..Can some one say how to fix this?

  • When installing Adobe Creativ Cloud, gives error code: 205! Why? Have downloaded numerous times. Dmg!

    When installing Adobe Creativ Cloud, gives error code: 205! Why? Have downloaded numerous times. Dmg!

    Colegio Oswald please see Error downloading Creative Cloud applications - http://helpx.adobe.com/creative-cloud/kb/error-downloading-cc-apps.html for information on how to resolve Error 205.

  • Trying to install software update, phone stopped responding and gives error code 9

    While trying to update software on my iPhone 4, it stopped during installation and gave error code 9, now it says the phone must be restored but will not complete the installation and still gives error code 9, very frustrating.  I tried on 3 different computers, same results.

    reset preferences -
    after effects:  http://helpx.adobe.com/after-effects/using/preferences.html
    flash:  http://helpx.adobe.com/flash/kb/re-create-preferences-flash-professional.html
    illustrator:  http://helpx.adobe.com/illustrator/using/setting-preferences.html
    indesign:  https://forums.adobe.com/thread/526990
    photoshop:  https://forums.adobe.com/thread/375776
    if that fails to solve the problem, restart in safe mode and test.  if ae works, you have a conflicting non-essential program.  you can use your activity monitor to find it.
    if restarting in safe mode fails, uninstall, clean (Do a clean install) and reinstall ae.

  • Model m8530f, no recent changes, blue screen of death. Diagnostic tools gives error code BIOME-1 .

    Model m8530f,  no changes in weeks, blue screen of death while away. Diagnostic tools gives error code BIOME-1 .

    Asamd1st, it appears that this is a memory error.  I suggest removing the memory and reinstalling them one at a time.  Then, boot to see if the computer runs properly.  Do this with each stick.
    Please click "Accept as Solution" if your problem is solved.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • Since upgrading to ios 8.0.2, airprint will give error (no printer found" After a reboot, it locates and prints, then next time same error code. Any ideas?

    Since upgrading to ios 8.0.2, airprint will give error (no printer found" After a reboot, it locates and prints, then next time same error code. Any ideas?

    Hi bdtcop,
    I understand that you are experiencing an issue with AirPrint. Here is an article for you with some troubleshooting steps that may be helpful for resolving this issue:
    About AirPrint
    http://support.apple.com/kb/ht4356
    If you're unable to print
    Check these things if you are unable to print, or if you see the message "No AirPrint Printers Found."
    Make sure your printer has paper, and enough ink or toner installed.
    Make sure your printer is connected to the same Wi-Fi network as your iOS device.
    Make sure your printer has power and is turned on. Try turning your printer off and then back on again to see if it resolves your issue.
    Check to see if your printer has any error lights or indicators displayed on the printer's control panel. Check the documentation that came with your printer to clear any errors displayed.
    Check with your printer's manufacturer to see if any firmware updates are available for your printer. Check your printer's documentation or contact the printer vendor for more information. A firmware update may be available, even if you just bought your printer.
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • How to Update a clob column..it gives error string literal too long

    I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
    ORA-01704: string literal too long

    Peeyush wrote:
    I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
    ORA-01704: string literal too longThere's a problem with my car. It won't start. Why won't it start? Please tell me!
    Oh wait, you can't, because I haven't given you nearly enough information...
    In other words, if you would like help in trying to work out where you've gone wrong, you should provide a small enough example of your code that demonstrates the error. We might then actually stand a chance of being able to help you!

  • SSAS Tabular - Adding Column to a table gives error "Object reference not set to instance of object"

    If I make changes to a table in SSAS Tabular Visual Studio, the newly added column gives error as "Object
    reference not set to instance of object"

    Hi VikasJain13,
    According to your description, you get the "Object reference not set to instance of object" error when adding columns in Tabular. Right?
    Generally, it throws this error when the internal code is accessing the property of an empty object. As you mentioned it happens when you make changes on a table, mostly it means that table is already a empty object. Please re-process your tabular to see
    if this table is still existing. 
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • The system cannot find the path specified.---- Error code:-2147467259 Error code name:failed

    Friends,
                I'm facing below issue while accessing a crystal report. I heard it might be an access issue. But i'm able to access a report within a same folder.
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException : The system cannot find the path specified.---- Error code:-2147467259 Error code name:failed
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    Any suggestions would be very helpful.
    Thanks in Advance,
    Bharath

    Apply trace on RAS and look for errors in the RAS logs at the same timestamp.
    These errors come for various errors and tracing RAS would give us a better idea.
    It might hapen that you observe these errors for reports which takes more than the RAS timeout to export the reports.
    Post getting the RAS logs you can try below steps if we see timeout errors in RAS logs.
    Copy clientSDKOptions.xml file from <BO install path>\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib to the machine where your app is running Open clientSDKOptions.xml and change CORBARequestTimeOut from 600000 to a value large enough to allow the report to render, for instance 1200000. Default value is 600000 (10 minutes)
    Specify the location of the clientSDKOptions.xml file at run-time. In your JSP or Java files, use the Java method setProperty from the System class. Set the system property indicated by the ras.config key to the specified directory as: system.setProperty("ras.config","c:\temp"). This function call specifies that the clientSDKOptions.xml file in c:\temp is to be used for locating RAS servers.
    Thanks,
    Prithvi

  • Proxy to File - CLIENT_RECEIVE_FAILED - error code: 200, error text:

    I have configured a Proxy to JDBC scenario from a new ECC dev system and it works great.  I recently tried migrating the changes to the new ECC qas environment and I get the following error message.  Can anyone help, I must have missed some configuration somewhere?
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Integration Server
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="INTERNAL">CLIENT_RECEIVE_FAILED</SAP:Code>
      <SAP:P1>200</SAP:P1>
      <SAP:P2>Error Parsing Response. No XI Response Received.</SAP:P2>
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText><html> <head> <title>SAP J2EE Engine Start Page</title> </head> <frameset framespacing="0" border="0" rows="90,*" frameborder="0"> <frame name="banner" scrolling="no" noresize target="contents" src="top.html" marginwidth="0" marginheight="0"> <frame name="main" src="main.html" marginwidth="10" marginheight="30" scrolling="auto"> <noframes> <body> <p>This page uses frames, but your browser doesn't support them.</p> </body> </noframes> </frameset> </html></SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Error while receiving by HTTP (error code: 200, error text: Error Parsing Response. No XI Response Received.)</SAP:Stack>
      <SAP:Retry>A</SAP:Retry>
      </SAP:Error>

    Hi!
    I think what michal told is correct there is a connectivity issue but please make sure regarding mapping also why it is unable to receive the response...
    Actually ERROR 200 code means::
    Description: The request has succeeded. The information returned with the response is dependent on the method used in the request GET an entity corresponding to the requested resource is sent in the response; HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body; POST an entity describing or containing the result of the action; TRACE an entity containing the request message as received by the end server.
    Possible Tips:
    Have a look into SAP Note: 871959..
    I know this is not an exact answet but this ill give u some idea..
    Regards::
    Amar Srinivas Eli

Maybe you are looking for

  • PDF is not dynamic in WebDynpro

    Hi, I designed a pdf form in standalone adobe designer 7.1. I saved the file as DYNAMIC pdf. When I test the form standolne the form works. I have a WDJ with a view, which contains an Interactive Form element. I linked the dynamic pdf to the designer

  • How do you download when you keep getting error 7 messages?

    how do you download/upgrade itunes ? I have tried downloading from the web page and automatically download off computer. I keep getting error 7 messages. What can be done?

  • Can we create a form with dreamweaver for muse

    Hello, I need help because please because I want to create a form with choices and I can't do it with muse. I would like to know if someone can tell me if i can do it with dreamweaver and insert into muse after. Thank you for your help.

  • My printer wants to print 99 copies everytime

    My printer recently started to go to 99 copies everytime I put something in to print. HOw can I change it so it goes to 1 automatically?

  • Service(Jobwork scenario) billing

    Hi all, For manufacturing scenario we have biling doc. & the exc.inv. no. , exc.inv will be used by FI personel for CST/VAT  filing, Where as for service scenario we got billing no.(different no. range to manufactrng) here FI personel objects filing