Some syntax problems (I guess)

Hi, I'm having problem with the first constructor in this simplified example code... I want to create a "default" Comparator. I'm not quite sure how to do this.
public class MyClass<E> {
    private Comparator<E> comp;
    public MyClass() {
        MyClass(new ComparableComparatorBridge());
    public Myclass(Comparator<E> comp) {
        this.comp = comp;
    private class ComparableComparatorBridge<E extends Comparable> implements Comparator<E> {
        public int compare(E o1, E o2) {
            return ((Comparable)o1).compareTo(o2);
}

Event if you fix the syntax problems, following the advice of the other posters, you'll have a semantic problem:
MyClass<E> is parameterized with an unbounded type parameter.
You cannot assume that E implements Comparable<E>.
What you'd really need is a parameterizd constructor like this (won't compile):public <C extends E & Comparable<E>> MyClass() {
this(new ComparableComparatorBridge<C>());
}Unfortunately, this isn't valid Java. I see two possibilities:
1. Derive from MyClass and introduce the additional bound on the type parameter of the subclass. Then you can create a default-constructor using the ComparableComparatorBridge in that subclass.
2. Add a static factory function to MyClass, like this:
public class MyClass<E> {
    private final Comparator<E> comp;
    public MyClass(Comparator<E> comp) {
        this.comp = comp;
    public static <E extends Comparable<E>> MyClass<E> defaultComparable() {
        return new MyClass<E>(new ComparableComparatorBridge<E>());
    private static class ComparableComparatorBridge<E extends Comparable<E>> implements Comparator<E> {
        public int compare(E o1, E o2) {
            return o1.compareTo(o2);
}

Similar Messages

  • My computer has some serious problems, my iphoto only shows thumb size pics when I try to open them, i tried to rebuild my files from folders that had the pics in them. originally all the photos has a large delta with a question mark. also I can't back up

    my computer has some serious problems, my iphoto only shows  only shows thumb size pics when I try to open them, i tried to rebuild my files from folders that had the pics in them. originally all the photos had a large delta with a question mark. also I can't back up the library file because its not there. I went to time machune and tried to find the file but I can't find it or I am looking in the wrong place. I also lost my Idvd file, only have broken chain showing.

    Details please
    What version of iPhoto and of the OS?
    i tried to rebuild my files from folders that had the pics in them.
    Exactly what did you do and how did you do it? this ay be the cause of your issue but without details we can n=ony guess
    my iphoto only shows  only shows thumb size pics when I try to open them,
    where do you see htis? In the iPhoto window? what does "try to pen them" exactly mean?
    originally all the photos had a large delta with a question mark.
    Ok - this usually has a simple solution - do you still have a copy of the library that has this problem?
    also I can't back up the library file because its not there.
    This makes no sense at all - all of your previous statements indicate that you do have an iPhoto library but have some problems with it
    By default your iPHoto library is located in your Pictures folder and is named iPhtoo library - if tha tis not the case the you have moved or renamed it and only you know what you did until you tell us the details
    I went to time machune and tried to find the file but I can't find it or I am looking in the wrong place.
    Again unless you actually share what and how you are doing thing but continue to simply state abstract problems it is no possible to assist you - details on using Time Machine are here  --  http://support.apple.com/kb/HT1427?viewlocale=en_US&locale=en_US   --     and   --    http://pondini.org/TM/FAQ.html   ---
    I also lost my Idvd file, only have broken chain showing.
    This would be better addressed in the iDVD forum - but again unlesss yu share detailed information no one can assist
    LN

  • A Full DTP is converted into delta DTP and facing some data problem

    Recently Full DTP(DSO to DSO) is converted into delta DTP , we are facing some data problem in first request.Some data in D2 are not updated properly after just converted in full to delta. Please let me know if you have any idea.
    Example :
    DSO : D1
    DSO : D2
    Previously FULL DTP D1->D2
    Now Delta DTP D1->D2

    Hi,
    First time run of delta DTP will extract all the records from the source...
    As u have already run the Full load and followed by delta,i guess u can use direct change log option...
    rgds,

  • Some serious problems with Mountain Lion

    Hi everyone,
    I upgraded my mid 2010 15" MBP to Mountain Lion 2 days ago, and I have some serious problems with my machine now.
    - Wifi problem: like many members 's machines, mine has problem to connect to the wifi after sleep or restarting, I had to wait 10 to 15 minutes for it to connected to my home network. Anh I tried to remove all of my settings in System Preferences/Network and added new connection. And now it cant connect to wifi anymore. I'm writing this article while sitting on the floor with my Ethernet cable plugged in my MBP. I connected to internet through a DSL modem and a Airport Extreme as a bridge and Access Point. I also tried to set up all of my network device but my MBP can't connect to the wifi still.
    - Keyboard problem with Pages: I was very happy with the new iCloud syncing for Pages documents but after 5 minutes, I met a big problem with Mountain Lion. Whenever I type in Pages with Vietnames Keyboard( Mac OS X built in or from another developer: http://www.trankynam.com/gotv/ ), Pages stops working immediately. I can still drag the Pages's window around but can't type or do any editing. After that I have to force quit pages. It is really stupid that I'm writing a book in Pages and now I have to stop my working till apple fixes this ridiculous bug. I tried German Keyboard as well and Pages worked flawlessly. Do you hate Vietnamese, Apple?
    - Messages problem: Since upgrading to Mountain Lion I couln't send or receive any messages. It worked perfectly in Messages beta.
    Does anyone have the same problems like me? Any solution such as how to reinstall Messages(I googled but found nothing)
    Apple, please test your software more before release it. I feel like I have no computer at the moment because I can't work, can't surfing the web wirelessly and can't communicate with my friends.

    HI,
    - Messages problem: Since upgrading to Mountain Lion I couldn't send or receive any messages. It worked perfectly in Messages beta.
    Does anyone have the same problems like me? Any solution such as how to reinstall Messages(I googled but found nothing)
    What Messages to what type of Buddies or Contacts ?
    This
    I found out that the problem with my wifi was my MBP received automatically a ridiculous IP such as 169.254.170.0 instead of 192.168.1.4 as it should be.
    WIll be part of the Issue as will be DNS issues.
    mDNSresponder crashed with Handsoff! v1.5.3. After upgrading Handsoff! to v2.0.2, it works again.
    In this case mDNSresponder also being stopped will stop DNS working.
    I would guess if you have resolved these that you can Chat to people again.
    4:33 PM      Friday; July 27, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Syntax problem After the Upgrade to SCM 7.0

    We are facing one problem during the upgrade process in the sandbox environment.
    After the upgrade we have completed the SPAU corrections ,while doing the SPAU corrections we found that one function module is not in active mode. We have checked the syntax,problem is there. we have tried to retrieve to the older version. But there are some notes were implemented during the 4.1 version. Those notes are now appearing in the SPAU with question mark.
    We have reverted all the notes but still the code is having syntax problem and the code is in the 4.1 version only.
    Please tell me how to solve it...
    Moderator message - Welcome to SCN.
    But
    Moderator message - Cross post locked(please pick one forum or the other)
    Edited by: Rob Burbank on Nov 3, 2009 12:03 PM

    Hello Bouchards,
    Thank you for the question.  You can find Frequent Locations under Settings > Privacy > Location Services > System Services:
    You can find more information at the following link:
    iOS 7: Understanding Location Services
    http://support.apple.com/kb/HT5594
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Can I use a mini dvi to video adapter on my Macbook 7.1 of have some compatibility problems?

    I have a Macbook 7,1 and I want to buy a mini dvi to video (s-video and rca) to plug my macbook to my analog TV.... I want to know, if this have some compatibilty problems... or not....
    tengo una macbook 7.1 y quiero comprar un cable de mini dvi a video compuesto.... en la pagina de apple señala que esta diseñado para imac (intel) y powerbook de 12" que ya ni existen creo.... lo unico que quiero saber es si funcionaria o no el adaptador con mi macbook...

    The first review posting on the product page is:
    +dosen't work on mac pro with nvidia!!!!!+
    +Written by PH from hamburg+
    +August 27, 2007+
    Which suggests no. I have heard from an Apple Store "genius" that it does.
    Both are n=1, so I'd suggest a call to the Apple Store sales line (even if you don't order it that way).

  • Hi team , I have some questions/Problem for my product apple (iPad,iPhone) , I want to employee speak and type thai language

    Hi team , I have some questions/Problem for my product apple (iPad,) , I want to employee that can  speak  or response me in thai language
    1. ผม อาคเนย์  พำนักอยู่ประเทศไทย กรุงเทพฯ  มีปัญหาสอบถาม ดังต่อไปนี้
       - กระผมได้ทำการตัดบัตร เครดิต เพื่อซื้อเกมส์ผ่าน itune store ผ่าน apple itune ID : misskor.yaprom@*** เพื่อซื้อเกมส์ Eleves Realm ในวันที่18 ก.ค. 56 เวลา 17.07น. ซึ่งทางบัตรเครดิตได้แจ้งเรียกเก็บเงินมายอดเงิน 39.99$ ซึ่งในระบบจริงๆ ทางกระผมต้องการตัดในยอด 99.99$ แต่พอได้ประสานงานไปยังธนาคาร ได้รับการแจ้งกลับมาว่า ได้ทำการตัดบัตรในยอดเงิน 39.99$ ซึ่งในความเป็นจริงนั้น กระผมไม่ได้สั่งซื้อเกมส์ในยอด 39.99$ ซึ่งในยอด 99.99$ นั้นพยายามตัดในระบบบัตรเครดิตอยู่ แต่ทางกระผมได้ยืนยันกลับไปว่าไม่ให้ระบบตัดนะครับ เพราะว่าเนื่องจากมีปัญหาในการชำระเงินระหว่าง Apple itune store อยู่
       - ทั้งนี้ขอให้ทางเจ้าหน้าที่ประสานงานตรวจสอบ apple itune ID : misskor.yaprom@*** เพื่อซื้อเกมส์ Eleves Realm ตามที่ได้ให้รายละเอียดโดยด่วนว่าเป็นเพราะว่าระบบมีปัญหาหรือว่ามีอะไรเกิดขึ้นในข ั้นตอนการชำระเงินครับ
    รบกวนประสานงานกลับมายังกระผม อาคเนย์ ที่หมายเลขโทรศัพท์มือถือ +**** / reply feedback  email : lekod1@*** โดยด่วน ในวันศุกร์ที่ 19 ก.ค. 2556 ครับ
    ขอบคุณครับ
    อาคเนย์  อุดปิน
    กด
    <Edited By Host>

    Google translation:
    พนักงานของ iTunes Store จะไม่ได้อ่านข้อความในเว็บบอร์ดนี้ ถ้าคุณต้องการความช่วยเหลือสำหรับปัญหาที่มีใน iTunes Store, คุณจะต้องติดต่อกับพวกเขาผ่านทางแบบฟอร์มเว็บนี้:
    http://www.apple.com/emea/support/itunes/contact.html

  • I am having some huge problems with my colorspace settings. Every time I upload my raw files from my Canon 5D mark II or 6D the pics are perfect in color. That includes the back of my camera, the pic viewer on my macbook pro, and previews. They even look

    I am having some huge problems with my colorspace settings. Every time I upload my raw files from my Canon 5D mark II or 6D the pics are perfect in color. That includes the back of my camera, the pic viewer on my macbook pro, and previews. They even look normal when I first open them in photoshop. I will edit, save, and then realize once i've sent it to myself to test the color is WAY off. This only happens in photoshop. I've read some forums and have tried different things, but it seems to be making it worse. PLEASE HELP! Even viewing the saved image on the mac's pic viewer is way off once i've edited in photoshop. I am having to adjust all my colors by emailing myself to test. Its just getting ridiculous.

    Check the color space in camera raw, the options are in the link at the bottom of the dialog box. Then when saving make sure you save it to the srgb color space when sending to others. Not all programs understand color space and or will default to srgb. That won't necessarily mean it will be accurate, but it will put it in the ballpark. Using save for web will use the srgb color space.

  • I am experiencing some major problems with my MacBook Pro. I have had some issues with it turning on/off at random times, but today, when starting, I get the grey start-up screen and a recovery bar. After filling in approx 1/4 of the way, the machine dies

    I am experiencing some major problems with my MacBook Pro. I have had some issues with it turning on/off at random times, but today, when starting, I get the grey start-up screen and a recovery bar. After filling in approx 1/4 of the way, the machine dies. After starting it in recovery mode, it will not allow me to download OS X Mavericks- it says the disk is locked. Any ideas? I do not have a back-up and do not want to erase everything before I have explored my options. Help?

    try forcing internet recover, hold 3 keys - command, option, r - you should see a spinning globe
    most people will tell you to do both pram and smc resets (google) and if you still have issues, either clean install (easy) or troubleshoot (hard)

  • I cannot run You Tube Videos on my Apple Macbook Air MD760HN/B with OS X 10.9.4. the video window displays a message " An error occurred, Please try again later." Learn more. The screen is black with this message. There appears to be some setting problem?

    Macbook Air MD 760HN/B with OS X 10.9.4
    4 GB RAM, 1.4 Ghz intel Core i5
    Problem 1
    I.     On Youtube whenever I try to play a video, I get a message on a black screen "An Error Occurred, Please Try Again later. Learn More."
    2.   I think it is some setting problem, being a new mac user, I am unable to sort it out.
    Problem 2.
    How to select more than one file in a folder to copy or delete. like it can be done in Windows with shift Click together.
    if one has to select say, file 25 to file 37 in a folder with 75 files. select all (command A) works but I cannot select few continuous files.

    Macbook Air MD 760HN/B with OS X 10.9.4
    4 GB RAM, 1.4 Ghz intel Core i5
    Problem 1
    I.     On Youtube whenever I try to play a video, I get a message on a black screen "An Error Occurred, Please Try Again later. Learn More."
    2.   I think it is some setting problem, being a new mac user, I am unable to sort it out.
    Problem 2.
    How to select more than one file in a folder to copy or delete. like it can be done in Windows with shift Click together.
    if one has to select say, file 25 to file 37 in a folder with 75 files. select all (command A) works but I cannot select few continuous files.

  • Hello guys my i phone touch is not working on edges and some touch problem and it is not taking too much time too respond it is purshecd in kuwait can i get replace in india

    hello guys my i phone touch is not working on edges and some touch problem and it is not taking too much time too respond it is purshecd in kuwait can i get replace in india it is i phone 4s

    saikumar3 wrote:
    ...it is purshecd in kuwait can i get replace in india it is i phone 4s
    No, warranty is not International and is only valid in country of purchase.

  • Some strange problem with Flash/As3

    Hi,
    I am having some strange problem with my flash cs3.
    Whatever script I write in as3  doesn't work, even a stop() function doesn't work . But when I change my publish setting to as2 it works fine.
    Not sure about the root cause, may be some setting or preference or my cs3 is corrupted.
    Can anybody please advise.
    Thanks,
    Kishor

    try this
    create a new fla as3,
    select frame 1
    open the actions panel
    paste in the following code
    var squares:Array = new Array;
    setup();
    function setup():void {
        for (var i = 0; i < 25; i++) {
            var square:Sprite = new Sprite();
            //square.name = "square" + i;
            square.graphics.beginFill(Math.random() * 0xffffff);
            squares.push(square);
            squares[i].graphics.drawRect(0, 0, 100, 100);
            squares[i].x = i*3;
            squares[i].y = i*3;
            squares[i].filters = [];
            square.graphics.endFill();
            stage.addChild(squares[i]);
    for (var j = 0; j < squares.length; j++) {
        squares[j].addEventListener(MouseEvent.MOUSE_DOWN, dragMovie);
        squares[j].addEventListener(MouseEvent.MOUSE_UP, dropMovie);
        squares[j].buttonMode = true;
    function dragMovie(event:MouseEvent):void {
        event.target.startDrag();
    function dropMovie(event:MouseEvent):void {
        event.target.stopDrag();

  • The password for the account "account name" was not changed. Your system administrator may not allow you to change your password or there was some other problem with your password. Contact your system administrator for help.

    I have a user who's Active Directory password is going to expire. I had her reset her password by going to apple > system prefs > user > and clicking change password. She received the error "The password for the account "account name" was not changed. Your system administrator may not allow you to change your password or there was some other problem with your password. Contact your system administrator for help."
    I had her change her password via the kpasswd command in terminal and that changed her password on the server sucessfully however the laptop has FileVault on it. Filevault is not recognizing the new password just the old password.
    I have deleted the keychain which didn't resolve and now I am going to decrypt and reencrypt the drive. I'm hoping this is an isolated issue I have over 25 laptops configured like this.

    I "think" the trick was unbinding and rebinding the computer account.
    After unencrypting and trying to reencrypt Filevault would still not take the new password.
    Rebooted the prompt to update the keychain appeared. Updated the keychain. Filevault would still not take the new password.
    Unbinded and rebinded the computer account. It worked and let me add the user to filevault.

  • I installed lv 6.1 on a windows 98 system. As I am having problems of stability (much more than with the former release 6.0), I would like to know if there is some specific problem with windows 98 or there is some patch.

    I installed lv 6.1 on a windows 98 system. As I am having problems of stability (frequent crashes, much more than with the former release 6.0), I would like to know if there is some specific problem with windows 98 or there is some patch available.

    My experience with Win98 is that it is not a very stable system, regardless of software used. For example, Win2000 and XP are far more stable than 98. I've had it crash on its own if I leave the computer on for several days.
    I wouldn't recommend running programs for long time (few days) on this OS.
    This being said, can you be more specific in your question. What kind of stability problems did you have, which VIs did you run (if possible post them here), did you change the interrupts and priority levels on those VI, do you get error messages or blue screen....
    Zvezdana S.

  • How do I get flash to stop looping? (And some other problems too)

    I'm brand new to flash so cut me a little slack... 
    I'm in the middle of building a website in Flash CS4 in Action Script 3.0 and (according my the tutorial I'm using) I need to access the "parameters" panel. The problem is I don't see it anywhere. I see "properties" and "filters" but to parameters. I've cycled through all the workspace presets but with no luck. How can I bring it up??
    Also, even though I used the "stop();" code in the beginning of my actions frame my movie just keeps looping when I test it. What am I doing wrong?
    I've attached the file I'm working on, maybe there's some other problem as well..?
    Thanks in advance..

    to see the parameters panel drag a component (like the flvplayback component) onto the stage.  a parameters panel should appear.
    if you have no compiler errors and your swf plays past a stop(), you have other code that's executing after the stop() causing your timeline to advance.

Maybe you are looking for

  • Showing less data at retrival time

    Hi Everyone, I have a datafile with me to load the data into cube.when i am loading the data it is loading succeesfully with out any error but at the time of retrival of data it is showing less when i compared with my original data. Then i checked th

  • Can anyone tell me if they know where I can find a hard case for the new Retina Macbook Pro?

    Can anyone tell me where I can find a hard case for a new 15" retina macbook pro?

  • PROBLEM WITH RFC DESTINATION

    Hi GURU, I have a problem with the record of RFC destination. When i created RFC destination TCP/IP when i made the tests, it`s ok. But when i used this rfc destination in a  function of ABAP. I have an error. The error is: RfcExecProgram'#Win32 erro

  • Wacom Problems Intuos4 iMac 27"

    I am getting the "A supported tablet was not found on the system" on the System Prefs. It is plugged in. I have installed the latest drivers. I have even removed and reinstalled using the Wacom Tablet Utility as per discussions I have found here. I h

  • Issue with zoom

    I need help with this issue I am having with my layout. If you were to go to my site and either zoom in or decrease the size of the browser window, two undesirable things will happen. 1. The content part of my page will cover the navigation buttons 2