• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TreeSet contains "something like this"

 
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following code:



Basically if kFields, cFields contain field I enter the if condition.

My boss wants me to add a regular expression to kField. Example:

kField would contain among other things: TEXT*

The desired effect is in the if statement above, if field contains TEXT1, TEXT2...TEXT<anything> I will enter the if condition. The star acts as a wildcard.

I was thinking about how to do this.

I could step through the TreeSet and compare each value to the value contained in Field using regex. This seems a little expensive.

Is there any easier way? Perhaps a better collection for this? Maybe I should sub class TreeSet and make my own contains that handles regex? This is part of a method that is becoming a performance concern for me, so I would like to be as effecient as possible.

Any suggestions,

Thanks,

Luke
[ March 18, 2005: Message edited by: Luke Shannon ]
 
Luke Shannon
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the solution I ended up with. If anyone can think of a better way please let me know.

Luke

 
reply
    Bookmark Topic Watch Topic
  • New Topic