This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Bouncing a String Against a List of Strings  RSS feed

 
Ranch Hand
Posts: 1931
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I would like to check a string for specific contents using a list of strings in lieu of long hand coding for each possibility.

That way I could set up an application parameter so that I could control the list on the fly.

My current code is:

 
Saloon Keeper
Posts: 2195
92
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that itemChild.getItdsc() returns a list, why cant you just check each item against another list ?

 
Steve Dyke
Ranch Hand
Posts: 1931
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

salvin francis wrote:Assuming that itemChild.getItdsc() returns a list, why cant you just check each item against another list ?



Sorry,  itemChild.getItdsc() is a simple string(drawing title) like: 'SEAT ASSY, ISB, 5100 T/C'.
 
Rancher
Posts: 3121
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Steve,

this one turned out to be more difficult than I thought. I took Salvins code, and I changed it a little to take into account that your itdsc contains elements with more than one String. I give two ways, biggest problem that took me some time was to realize that if a and b are two Sets, then a,addAll(b) does not return a, but a boolean, leading to one of those dreaded incomprehensible compiler errors...
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!