Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Simple method but hard with generics: compareTo()

416044Feb 21 2005 — edited Nov 23 2005
I adjusted my getMaximum() method to generics to avoid the compiler warnings:
    static public Comparable<Comparable> getMaximum(Comparable<Comparable> comparable1, Comparable<Comparable> comparable2) {
        Comparable<Comparable> result = (comparable1 != null) ? comparable1 : comparable2; //init
        
        if (comparable1 != null && comparable2 != null) {
            int c = comparable1.compareTo(comparable2);
            result = (c > 0) ? comparable1 : comparable2; //comparable1 > comparable2?
        }
        
        return result;
    }//getMaximum()
But now, my other classes that call this method e.g. with 2 dates or with 2 numbers don't compile anymore. I tried
    static public Comparable<? extends Comparable> getMaximum(Comparable<? extends Comparable> comparable1, Comparable<? extends Comparable> comparable2) {
        Comparable<? extends Comparable> result = comparable1; //default
        
        if (comparable1 != null && comparable2 != null) {
            int c = comparable1.compareTo(comparable2); //compile error
            if (c <= 0) {
                result = comparable2;
            }
        } else if (comparable1 == null) {
            result = comparable2;
        }
        
        return result;
    }//getMaximum()
but this code doesn't compile:

Bound mismatch: The method compareTo(? extends Comparable) of type
Comparable<? extends Comparable> is not applicable for the arguments
(Comparable<? extends Comparable>). The wildcard parameter ? extends
Comparable has no lower bound, and may actually be more restrictive than argument
Comparable<? extends Comparable>

Comments

EdStevens
user9200169 wrote:
Hi,

I want to download the OEl patch for 11g/r2 so that I can test flash cache on my personal computer ...

I have been told that the patch can be obtained from oracle support, but when I try to get on the site im asked for a Sun Support Identifier or Contract ID....

Does this mean I have to buy a support liscence simply to get this patch? thats ridiculus!!
Why is that ridiculous? Having access to patches is part of "support".
729338
Hi,

It looks you are new to Oracle world. This has been the case always. You can download the base versions for your learning purpose, but any patches can be available to download if you have Oracle support license. Otherwise the patches are not available. I think this is true for any company. Oracle provide you full software to download for test/learning purpose, others may give you license for 15 days only.

Regards
781089
Im testing flash cache as part of a colllage report...

So basically your saying that I cant finish it because I cant get the patch a need .... unless i shell out for a years support with Oracle?....(which I can't anywhere near afford) ...?

Brilliant , Thanks Oracle!
729338
Check with your College, if they have Oracle support and can get you the patch that you need. If Oracle starts giving patches as free without Oracle support, then who will buy their software when I can get the whole software and support free.

Regards
781089
They dont.

I only need one patch for flash cache! .... Do they really consider $460 for patch fair?!? for a student!?

Im shocked... should have gone no where near Oracle!
781089
Infact its a major piece of functionallity that can't be used with out the patch!

How can this be right?

Edited by: user9200169 on Aug 6, 2010 3:03 PM
sb92075
How can this be right?
Oracle is under no obligation to give away their software for free.
damorgan
When and where did you get the impression that you could go to Microsoft for free copies of SQL Server, IBM for free copies of DB/2 and Informix?

I taught Oracle at the University of Washington for 10 years and not once did I ever have a student put themselves into the position you appear to have created for yourself. My recommendation would be that you sit down with your professor and explain your situation. Perhaps that person will be more sympathetic than I am at the moment and give you time to select something else to do.
1 - 8
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 21 2005
Added on Feb 21 2005
15 comments
2,035 views