• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Please review my criteriaFind method

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there
Please review and comment my criteriaFind method implementation.
fieldMap - HashMap contains field name as the Key and order number of it as the value.

[ December 20, 2002: Message edited by: Junilu Lacar ]
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sergei,
if it works, it is ok.
However, I find your method somewhat long. I stuffed all this parsing and matching into a separate class, thus encapsulating it.
As a rule of thumb: your methods should be so long that you can view them on the screen without scrolling. If your methods are longer than that, consider refactoring them.
Besides, I used two tokenizers, one for separating the key-value pairs, and the other one for separating the key from the value. Instead of putting all possible delimiters into one string you could use the nextToken(String delim) method.
Hope this helps.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic