• 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

sorting a NodeList

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I wondering does anyone have any thoughts on this
I'm trying to sort a NodeList but since the interface does not implement List I'm having to maybe use a NodeSet or something like that in order to use the Collections.sort(List, Comparator) method.
Is this the best way to go or should I just dump the whole thing into an array of Nodes.
Thanks,
Barry
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would try to use the Collections classes as much as possible -- it's more flexible and less work than arrays.
 
Barry Higgins
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lasse,
I'm returning my NodeList from the getElementsByTagName(String) method in Element.
Do you know of any existing classes that implement both the List and NodeList interfaces?
Barry
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, no, I don't know of such classes. Besides, you should avoid mixing two implementations of the org.w3c.dom.* interfaces (for example, Node from Xerces2 and NodeList from Crimson) -- that might cause some nasty runtime exceptions in unexpected places...
 
Barry Higgins
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK Thanks for your help!
 
reply
    Bookmark Topic Watch Topic
  • New Topic