Recieve a value and search for a value greater than item

is this code correct if i wanted to recieve a single argument item and search the list for a value greater than item
public boolean greaterFound(Comparable item)
     int index = 0;
  while (index < numItems && listItems[index].compareTo(item) != 0)
      index++;
  return ((index-1) < (index));
}

Okay here are all the errors piece by piece.
public boolean greaterFound(Comparable item)
     int index = 0;Well to start with this is not an error per se. But I would just return true if I found a match and false otherwise. There may be some who think that is terrible... I disagree.
  while (index < numItems && listItems[index].compareTo(item) != 0)What is numItems?
That if is shady.
What you are checking for is flat out wrong.
      index++;I'd be returning true here
return ((index-1) < (index));This is just nonsense. As it stands will always return true and invalidates the rest of your code.

Similar Messages

  • How do I search for a value in an Excel sheet using ActixeX

    I am already accessing my excel sheets however I need to be able to search the sheet for a certain value and return the row/cell location. Is there an activeX control that can do this?

    You will need a reference to the range to search. This can be the entire sheet if you wish. Just wire that to the method node Find. Here you can specify all of the typical search options. Wire your string or number into the What input. For the what to LOOKAT value, use -4163 for Value and -4123 for formulas.
    The reference returned is the range of the found value. You can wire it into the property node Row and Column to get the location.
    Michael Munroe
    www.abcdef.biz
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

  • How to search for multiple values with Bex Prompts

    Hi,
    I would like to know  if it is possible to search for multiple values at the same time with Bex Prompts instead of searching one value at a time (please see the screen shot below). I searched the forum couldn't find any relevant answers. please let me know  how  to achieve?
    Thanks,
    Charvi.

    Hi Charvi,
    You can use wild card search to ensure you get multiple similar values listed as search output.use * for multiple characters and ? for single character.
    For Example, Ravi * would result you all employees with first name as Ravi
    You can use various search formats such as * Ravi * and * Ravi and Ra?? etc.
    Thanks
    Mallik

  • Stock report with value and qauntity for given date not month wise

    Hi gems,
    can any body give me the standard report for Stock value and qauntity for given date not month wise at storage location level

    Hi
    check the report S_P00_07000139 with the option inventory and raw material report- detail and selection date (from, to date same). List will give opening & closing balances with goods movment and their values.
    Thanks

  • How to search for a value in an iterator in Jdev 10.1.2?

    Hi!
    I need to search an iterator named "PermitYrIterator1" for a year value (e.g. 2009) that is stored in bindings.Yr in my jsp. How do I do this in my jsp's DataForwardAction Code) in Jdev 10.1.2?
    I need this in my "Create page." I need to search for this value because I want to check if I should re-execute the "PermitYrIterator1" so that it shows the newly added year in bindings.Yr or not. If bindings.Yr is found in the iterator then I do not need to re-execute the iterator. But if the newly entered year cannot be found then I need to re-execute the iterator.
    I hope you can help me immediately! Thanks!

    Hi,
    Anyone can help me on this please?

  • LSMW: What are Fixed Values and Translations for?

    Hi,
    I'm working with LSMW and I don't know what are Fixed Values and Translations for? They are on the "Maintain Fixed Values, Translations, User-Defined Routines" step.
    Thanks in advance,
    Gerard

    this is the step,we can process the reusable rules of a project.
    <b>Fixed value:</b> Here you can specify length, type, flag for lowercase/uppercase and value in addition to the description.
    this is nothing but CONSTANTS in your report programs.
    <b>Translation:</b> Here you can enter information on the source field and the target field.
    for example, your input file language value will be 2 characters and we need to send only 1 for LANG in SAP.
    so here we have to do the translation of 2chars to 1 char.
    so, we will give these set of values in this step.
    Message was edited by: Srikanth Kidambi

  • What is the values and meaning for parameter TCLAS in functions

    what is the values and meaning for parameter TCLAS in functions like
    HR_INFOTYPE_OPERATION
    regards
    jan

    Hi Jan,
    Good Morning,
    In TCLAS,
    A, B , T will be there.
    A- Master data and time data.
    B- Applicant data.
    T- Shift Schedule.
    So, here we can say the default value will be integrated according to the above ABT.
    Means in the feature ABKRS, if you give the default values for all the three, your payroll area will appear in Master Data and Time data. And in recruitment ( Appicant data ) and work schedules. Means you are getting ingrated to all the three.
    And you can observe the feature PINCH also.
    If you dont want to get integrate with Master data, then dont give the default value under the A- Master date and Time data. And if you want to get integrate with Recruitment , then give the default value under B.
    I think u got the clear idea about TCLAS.
    Dont forget to give the points
    Thanks in Advance
    Cheers
    Vijai

  • Good night,  I ended up making a purchase at Apple, but my credit card operator called me to confirm the values ​​and was told different values ​​than bought.  Purchases appeared as:  $ 159.70 (protocol 604627) $ 137.00 (protocol 604538) $ 105.39 (protoco

    good night,
    I ended up making a purchase at Apple, but my credit card operator called me to confirm the values ​​and was told different values ​​than bought.
    Purchases appeared as:
    $ 159.70 (protocol 604627)
    $ 137.00 (protocol 604538)
    $ 105.39 (protocol 604468)
    $ 0.01 (protocol 615633)
    Could you check what is happening? Because I had to cancel my card for security.
    Sincerely,

    np33td33 wrote:
    My purchases were:
    macBookPro
    office 2011
    iwork
    ilife
    and these purchases did not appear in the system credit card
    Call Apple at 1800MYAPPLE.  We just deal with MacBook Pro issues, and we have nothing to do with Apple.  Please read what others have posted.

  • Encountered an error when attempting to open Lightroom for the first time. Went to Lightroom Help and searched for the error "An error occurred when attempting to change modules". Non of the solutions helped. what now?

    Encountered an error when attempting to open Lightroom for the first time. Went to Lightroom Help and searched for the error "An error occurred when attempting to change modules". Non of the solutions helped. What now?

    I am getting this error message as well. I have just downloaded Lightroom recently. I try to click on Lightroom / preferences....and nothing happens. I tried to uninstall and it is greyed out so I can't do that either. Suggestions? Please help?

  • With ios6 the app store closes everytime i try and search for an app

    ok so everytime i try and search for an app on the app store through my itouch it closes out... it has only done it since i updated to ios6

    Common problem for some users after updating to iOS 6. No known solutions yet.

  • HT4623 I have just updated my i phone 4s with the new ios 6 software and most of my apps have disapeared when i got to the app store and search for an app i cant find i click on it and it says the app is installed. Iff i double click on it it opens. Any i

    I have just updated my i phone 4s with the new ios 6 software and most of my apps have disapeared when i got to the app store and search for an app i cant find i click on it and it says the app is installed. but i cant find it in my apps if i double click on it it opens. Any ideas?
    Thanks Pete

    I have the same problem.  Some of my purchased songs are missing also.

  • TS1347 when i add new contact to my iphone , and search for it i did't find it but it store in my phone and apperars when called me or i write the no

    when i add new contact to my iphone , and search for it i did't find it but it store in my phone and apperars when called me or i write the no

    In the Contacts app, select "Groups" in the upper left hand corner.
    Then select all the groups that are desired to be displayed.
    Select Done.
    Now search for the contact(s) in question.  Do they appear now?

  • How can I have one thing open in Safari on my MacBook Pro and search for another thing in Safari without closing out of the other? For instance, How can I leave Pandora playing while I search Facebook?

    How can I have one thing open in Safari on my MacBook Pro and search for another thing in Safari without closing out of the other? For instance, How can I leave Pandora playing while I search Facebook?

    With Safari open use the Command + T keyboard shortcut to open a new tab.
    Or, Command + N to open a new window.

  • Hi - how do  I download items already purchased?  I have tried store and search for available nloads but it t

    Hi - how do  I download items already purchased?  I have tried store and search for available downloads but it tells me they are already downloaded - they are not however - fyi I lost my phone so I am using a new phone with the same apple id and assumed I could just re-access my previously purcahsed items - how do I find them to download?
    Many thanks

    many thanks for a really fast response - Yes I have seen on other postings since you only get one hit and you are right I should have backed up and didn't as I am a bit of a novice and naive (but learning fast now).  Have used your suggestion and accessed and downloaded some historical apps.
    many thanks - I will ensure I back up regularly going forward. 
    Thanks again

  • IPad 3 keeps rebooting and searching for network

    Hello,
    I have an iPad 3 and after upgrading to ios7 not it keeps rebboting every five minuites and searching for network all the time.
    i tried to reset all setting then hard reset then i did a restore for the device now when it open it keeps in the activating mode and searching for networks also and restarting after 5 minuites.
    Please someone help me urgently.

    Restore as new (not from a backup) and test. If the problem continues, time to seek a Genius Bar appointment.

Maybe you are looking for