Ignoring case in Hashtable key names

Is there any way to check a Hashtable for a key value (which is a string) but to ignore the case of the letters in the string?
if(hashtable.contains(keyValue)){ .... }
returns false if the string keyValue has different capitalization from the key in the hashtable.
Thanks
J A

No, if you want to do it by subclassing Hashtable (incidentally, why Hashtable rather than HashMap?) then you want to override the put, get, contains, and remove methods to call String.lowerCase() on the key. Sylvia's suggestion was to insert a wrapper around String into the map rather than to subclass the map.

Similar Messages

  • Rename hashtable keys

    I need to rename some keys in an Hashtable, and i'm wondering if there are "better" ways than creating a new Hashtable and copying the values into it with different key names.

    About using HashMap instead of Hashtable i'm not sure
    i can do so, because i'm just modifying a part of a
    huge web app and i'd need to make sure the change
    doesn't affect other parts. Don't mess with it if you don't have to. I assumed (incorrectly) that this was a new program.
    By the way what's the
    advantage of HashMap over Hashtable ?HashMap isn't synchronized, and has some additional performance benefits over Hashtable. That doesn't mean that Hashtable is used when you need to synchronize the Map. The Collections class provides a method for that. The main reason is that Hashtable was replaced with HashMap. A new hashtable implementation was not created for no reason. There were problems with the original design. HashMap is a living class and will be updated and improved upon as needed. We can't say the same for Hashtable. The main reason Hashtable is still around is that it is used in too much code in the JDK and elsewhere. A lot of developers still use it and I think that's a huge mistake.

  • Interactive Reports filter ignoring case

    Is there a way to have the built-in interactive report filter ignore case? I am currently passing the 'LIKE' filter to my interactive report to search for employee names. I want it to ignore the case so 'SMITH' would be the same as 'Smith' when doing search.
    ie. upper(:P1_NAME) like upper(EMP.NAME)

    But I'm not capturing the time. The default format is DD-MON-RR.
    This is crazy, I have used other Adhoc tools that didn't treat dates that way.
    Seeing as the operators change depending on the data type selected by the user, the option must be controlled in the application. Oracle is excluding it for some reason, but they really need to let the administrator control that.
    This is in Interactive Reports. The users don't want to have to format the dates, or anything else. They just want to filter the data to a certain date and the = sign should be allowed. If they are capturing time, then the administrator can truncate the date and make it available via another field/column.
    Edited by: ABD -- DBA on Jan 22, 2010 11:56 AM
    Edited by: ABD -- DBA on Jan 25, 2010 8:05 AM

  • UI Designer, DataModel-View, Element-Search-Filter should ignore case

    Hi,
    I'm currently working within UI Designer and want to bind elements to my OWL.
    After selecting a name space and a BO afterwards, I want to search within the loaded BO meta data.
    Doing so, I figured out that the search is case sensitive.
    In other words, search for 'node' brings no results, but 'Node' does the job.
    Hopefully there are no derivations like 'nOde'
    @DevTeam, please do 'ignore case'.
    Thanks.
    ByD Studio release as of 05.March.2011
    Regards
    Martin

    Hi,
    I tested in 3.0, there the search is no longer case sensitive. So it seems to be corrected.
    Regards,
    Thomas

  • SCCM 2012 R2 Compliance Settings and registry key name

    Hello,
    in my baseline, i need to check if a registry key exists (..i know it's easy using an existential rule type), but i need to use the "LIKE" to compare the key name.
    Example: the registry key can have the name "RegKeyName_1" OR "RegKeyName_2" OR "RegKeyName_3" so i need to check something like "RegKeyName%"
    How can i do that? I hope it's clear...thanks!
    Paolo
    Bodo

    First you read the needed registry key values and then store them to variables, after that you compare these variables and return the value based on your needs.
    Some references on VBScript:
    http://ss64.com/vb/regread.html
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/06/22/how-can-i-compare-two-string-values-regardless-of-letter-case.aspx

  • Ignoring case.................

    Hello Experts ,
            I am trybin to read data from infotype table pa0002  . I am accepting  the Last name ( vorna ) as input .
    I am trying to fetch matching records in internal table USING SELECT QUERY .
    But the name (vorna ) is *case sensitive* so  in table name can be stored as
    Rahul
    RAHUL
    rahul
    If user input is RahuL . Query return zero number MATCHING  of records .
    My requirement is Query should return all three matching records .
    How can i  do the comparison of name to retrive all matching records IGNORING THE CASE .
    i tried following query
    SELECT PERNR VORNA NACHN GBDAT FROM PA0002
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        WHERE upper( VORNA )   = upper(  STRU_USERIP-VORNA )
        AND   ENDDA >= SY-DATUM
        AND   BEGDA <= SY-DATUM .
    But wont work since UPPER is not allowed ,
    can anyone provide solution to this problem .
    Your Help will be appericiated .
    thks ,
    Rushi

    hi,
    There are few ways to ignore case while selecting values :
    1. Have all the records in either Capitals or Small Letters in DataBase Table.
    2. Have one extra column with either Capitals or Small Letters to do search.
    3. Declare Range Tables.
    An Example of Ranges :
    a. Range declared for which search criteria is there.
    Data : lr_name TYPE RANGE OF fmfint-bezeich,
              lr_name_line LIKE LINE OF lr_name.
    Data lt_rfc type table of fmfint,
            wa_rfc type fmfint,
            w_output type fmfint,
           t_output type table of fmfint.
    b. i_name is the value entered by user in Search Criteria.
    if i_name is not initial.
          lr_name_line-sign = 'I'.
            lr_name_line-option = 'CP'.
            lr_name_line-low = i_name.
    APPEND lr_name_line to lr_name.
    ENDIF.
    c. Select all records.
    select * from fmfint into table lt_rfc.
    d. Filter records using Loop and where condition
    loop at lt_rfc into wa_rfc where
    bezeich IN lr_name.
    MOVE-CORRESPONDING lw_rfc TO w_output.
            APPEND w_output TO t_output.
            CLEAR: w_output,lw_rfc.
    endloop.
    now finally you have all records based on input entered in table t_output.

  • How to get key name  from parameter list

    hi..
    i want string from parameter list.. i hv already created parameter list like
    ADD_PARAMETER (param_list_id, 'EMPID', TEXT_PARAMETER,'123');
    ADD_PARAMETER (param_list_id, 'EMPNM', TEXT_PARAMETER, 'ABC');
    ADD_PARAMETER (param_list_id, 'EMPADD', TEXT_PARAMETER, 'XXX');
    i got value like '123' ,'ABC', 'XXX' using
    eg. get_parameter_attr(param_list_id,'EMPID',aprmlist,avalue)
    but i want key name like 'EMPID' , 'EMPNM', 'EMPADD' from param_list_id
    is it possible to get this key name from parameter list ???
    Thanks...

    I cannot think of a way to do that. The code that reads the list is supposed to know the key names. That is sort of the point with parameter lists. If you need to have parameter lists that can be interepreted by some code that doesn't know about a specific list but knows how to interpret it by inspecting the key names, perhaps you can specify a separate parameter list with the key names as values and call the keys of that list something generic?

  • Using a heirachical key name in bean:message

    This is sort of an odd requirement but it will help me out greatly if I can find a way to do this.
    I am working on creating a JSP which generates vxml. I am using a resource properties file to read in text that I need to speak, or the names of wave files that I need to play. I grab these using a bean:message tag lib call. This all works fine but now I need to extend this app to handle several different States (Kentucky, Ohio, etc) which may or may not have small variations in their verbiage.
    Tell me if I am going about this entirely wrong but this is what I think would be nice to do:
    I would like to use the name of the key in this form:
    "prompt.company.state"
    Where an example resource properties file might be like this:
    mainmenu.columbia.ky=mainmenu_ky.wav
    mainmenu.columbia=MM_Columbia.wav
    mainmenu=mainmenu.wavWhat I would like to happen is if I request the key "mainmenu.columbia.ky" it returns the "mainmenu_ky.wav", but if I request "mainmenu.columbia.oh" it would return "MM_Columbia.wav"
    The idea is that a company may operate in different states and customize its prompts for that state if custom prompts exist but if they do not exist it uses the default for that company. Also there could be different company names also so if I asked for "mainmenu.northface" I would receive "mainmenu.wav"
    This is sort of like localization but I want to have all the keys in one file.
    My thought is that I would need to create my own taglib that extends bean:message and then parses the key name accordingly until I find a matching key. My problem is I have no idea where to start when doing that. I am while I have a strong Java background its been almost 4 years since I've worked on a project using it, and all this Struts and JSP and JSTL stuff is quite new to me.
    Does anyone have any tips for me? Maybe there is another tag lib out there which does exactly what I need and I just don't see it. Help anyone?

    This is sort of an odd requirement but it will help me out greatly if I can find a way to do this.
    I am working on creating a JSP which generates vxml. I am using a resource properties file to read in text that I need to speak, or the names of wave files that I need to play. I grab these using a bean:message tag lib call. This all works fine but now I need to extend this app to handle several different States (Kentucky, Ohio, etc) which may or may not have small variations in their verbiage.
    Tell me if I am going about this entirely wrong but this is what I think would be nice to do:
    I would like to use the name of the key in this form:
    "prompt.company.state"
    Where an example resource properties file might be like this:
    mainmenu.columbia.ky=mainmenu_ky.wav
    mainmenu.columbia=MM_Columbia.wav
    mainmenu=mainmenu.wavWhat I would like to happen is if I request the key "mainmenu.columbia.ky" it returns the "mainmenu_ky.wav", but if I request "mainmenu.columbia.oh" it would return "MM_Columbia.wav"
    The idea is that a company may operate in different states and customize its prompts for that state if custom prompts exist but if they do not exist it uses the default for that company. Also there could be different company names also so if I asked for "mainmenu.northface" I would receive "mainmenu.wav"
    This is sort of like localization but I want to have all the keys in one file.
    My thought is that I would need to create my own taglib that extends bean:message and then parses the key name accordingly until I find a matching key. My problem is I have no idea where to start when doing that. I am while I have a strong Java background its been almost 4 years since I've worked on a project using it, and all this Struts and JSP and JSTL stuff is quite new to me.
    Does anyone have any tips for me? Maybe there is another tag lib out there which does exactly what I need and I just don't see it. Help anyone?

  • In which case composite primary key allows NULL values in it

    Hi to all
    In what case composite primary key allows nulls in it.
    Let us suppose, I created a composite primary key with 2 attributes.
    CREATE TABLE sample
    BNK_Id NUMBER(6),
    BNK_Name VARCHAR2(20),
    CONSTRAINT BNK_Id_Name_PK PRIMARY KEY(BNK_Id,BNK_Name)
    When it allows null values in it.
    thanks in advance

    Are you sure that your instructor was not talking about unique keys? As Solomon said, a primary key always implies not null on all of the columns of the PK. However a unique key does not automatically imply not null, and can have nulls in a column as long as the values in the populated columns are unique.
    SQL> create table test (
      2     id number,
      3     pid number,
      4     descr varchar2(10));
    Table created.
    SQL> alter table test add constraint test_unq
      2     unique (id, pid);
    Table altered.
    SQL> insert into test values (1, null, 'desc1');
    1 row created.
    SQL> insert into test values (2, null, 'desc2');
    1 row created.
    SQL> insert into test values (2, null, 'fail1');
    insert into test values (2, null, 'fail1')
    ERROR at line 1:
    ORA-00001: unique constraint (OPS$ORACLE.TEST_UNQ) violatedJohn

  • Why Hashtable class name is like this instead of HashTable

    I have a doubt in Collections, why Hashtable class name is like this, because, Every class name is start with CAPS like, ArrayList, SortedSet, etc. then the second name first letter should be in CAPS.
    Is that any special for that. Can anyone clear my doubt
    Thanks in advance.<!--Session data-->

    DrClap wrote:
    Because that's what they called it twelve years ago when they wrote it. I don't really think that asking about what a couple of people were thinking twelve years ago when they named a class is a good use of anybody's time. In fact I think it's a complete waste of time.may be

  • Mixed case in column & table name

    Hi,
    How can tell SQL to use mixed case for column & table name?
    For example:
    create table PerNode (netId number, nodeId number);
    select netId, nodeId from PerNode;
    The above statements automatically made to upper case. But I wanted to retain the case sensitiveness in the column & table names.
    I know a way by including the names in double quote in the case will make this to retain the case.
    But I don't want to give all the time the column & table names within double quote.
    What I wanted to know is that is there any ALTER kind of statement will make the SQL to use the case I use in the name of the column & table.
    I greatly appreciate your advice.
    Thanks,
    --JK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Oracle column names and table names are case insensitive unless you enclose them in quotes.
    Unless you want to have two tables, one called PerNode and one called pernode or some such, I'm not sure what benefit case sensitivity would have. One can certainly use mixed case SQL statements in stored procedures and ad-hoc SQL for readability-- only in the Oracle internals is everything changed to upper case.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • In the case without primary key

    Hi experts,
    In the case without primary key, we can define a primary key?
    In the case
    Source: SQL Server 2000
    Target: Oracle 11.2.0.3
    When both the source and target does not have primary key.
    Thank you
    Edited by: 891982 on 21 ก.ค. 2555, 18:41 น.

    GGSCI (win-ms) 48> stats msdp
    Sending STATS request to EXTRACT MSDP ...
    Start of Statistics at 2012-07-21 12:40:28.
    Output to E:\destgg\dirdat\dt:
    Extracting from dbo.City to dbo.test:
    *** Total statistics since 2012-07-21 12:36:30 ***
    Total inserts 2.00
    Total updates 0.00
    Total deletes 0.00
    Total discards 0.00
    Total operations 2.00
    and
    GGSCI (win-ms) 48> stats msdp
    Sending STATS request to EXTRACT MSDP ...
    Start of Statistics at 2012-07-21 12:40:28.
    Output to E:\destgg\dirdat\dt:
    Extracting from dbo.City to example.test:
    *** Total statistics since 2012-07-21 12:36:30 ***
    Total inserts 2.00
    Total updates 0.00
    Total deletes 0.00
    Total discards 0.00
    Total operations 2.00
    Thank you

  • ITunes ignores the "The" in artist names, but...

    iTunes ignores the "The" in artist names, but is there a way you can get it to ignore "The" is other languages, such as "Les" for French and "Die" for German?

    The simple answer is Yes, but you will have to do it manually for each song.
    Select the song that contains the "Les" or "Die" and right click and select get info.
    Go to the sorting tab.
    The second row has artist and sort artist.
    You want to keep the "artist" box the same and under the "sort artist" box, type in the name without "Les" or "Die"
    iTunes does this automatically for some words such as "A", "An" or "The"
    but if you want it done for other words, you have to do it manually.
    Hope this helps.

  • How can I show Foreign Key name in the Data model Table window

    Hi,
    In one of my table, I had a Foreign Key, but that is not indexed. I want to display the name with in the table second window in realtional data model. If it is indexed, then it is showing in third window. How I can show without indexing that column?
    Thanks.

    I want to show Foreign Key name in the second window.
    Thank you for considering my question,
    Sundar

  • When sorting, Itunes ignores "The" of my artists names

    When sorting, Itunes ignores "The" of my artist name.
    Is it normal?
    Like "The Offsprings" is sort with my "O" artist.
    Is there a way that I tune would recognize it?

    Ok but its weird, itunes recognize The on my bros laptop and not on mine.

Maybe you are looking for

  • How do I create a new emkey for Enterprise Manager Database Control?

    Hi, I just installed 11gR2. I am evaluating it. How do I create a new emkey for Enterprise Manager Database Control? I tried various combinations of this command: emctl config emkey I did find a probable bug: $ emctl config emkey -emkey -emkeyfile em

  • High Sea Purchases

    Hi, How we have to perform highsea purchase (inclusion of Import duties) in domestic scenario. Regards Mohan

  • SSIS Import is showing multiple Excels

    Hi There, When am trying to import data from spreadsheet to SQL Table is is giving me different excel names other than the one I wan to import. This is first time am seeing, please check below screenshot and suggest what to do. AM going to clean all

  • I have paired my device. Now how do I get my bookmarks?

    How do I pull up my bookmarks on my new device now that I've paired it?

  • Mac Pro 1.1 won't boot.

    So I got this tower from a friend because he said it was defective and I thought I could do something with it. He kept the hard drive so I got one from a recent Imac (640gig with OSX 10.6.5 installed). I know already that there is a problem with the