Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TreeSet collection and EJBs  RSS feed

 
John M Brown
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While learning EJBs, I was attempting to have an EJB return a TreeSet collection, and was unable to get it to work. I wanted to do this so the collection of data would come back ordered so the JSP (or the access bean) did not have to do the ordering.
Has anybody had the need to do this and got it to work? I particularly ran into troubles on where to define and implement the compareTo/equals methods when using the Comparable interface.
This was using the EJB 1.2 spec in Weblogic 5.1. Things probably work a lot differently in EJB 2.0.
 
Subrahmanyam Allamaraju
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The TreeSet takes a Comparator during its construction. You can supply your implementation of java.util.util.Comparator.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!