This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Searching a ResultSet

 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using java sql to get remote record data. After I get the ResultSet is there a faster way to searh for the existance of a string within the ResultSet other than iterating through the records with while loop?
 
Istvan Kovacs
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:I am using java sql to get remote record data. After I get the ResultSet is there a faster way to searh for the existance of a string within the ResultSet other than iterating through the records with while loop?


I don't know of any. Maybe you should change your SQL query to make the information you need more readily available?
 
Nevin kumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try Google's java collections,lambdaj features. you can apply filtering on all sort of collections.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Nevin: won't be any faster, though, just cleaner.

@Steve: no. As Istvan said, maybe querying better would be a cleaner solution.
 
Manish Singh
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fastest possible way would be an exact query to be sent to the DB. as the DB might make use of proper indexing and the unnecessary data wont travel from DB to the java machine.
 
Rob Spoor
Sheriff
Pie
Posts: 20510
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Istvan and Manish. Let the database server do the hard work, and as a bonus get less results so less network traffic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic