1 Reply Latest reply on Aug 19, 2007 4:03 PM by Paul Baker

    Sorted TreeNodes

    Paul Baker Apprentice

      Is there an easy way to sort the nodes of a tree?

       public Iterator getChildren() {
       return getCarriers().entrySet().iterator();
      




        • 1. Re: Sorted TreeNodes
          Paul Baker Apprentice

          Never mind.. I should have thought this out before posting...

          @SuppressWarnings("unchecked")
          public Iterator getChildren() {
           ArrayList<Map.Entry<Object, TreeNode>> carrierList = new ArrayList<Map.Entry<Object, TreeNode>>(getCarriers().entrySet());
           Collections.sort( carrierList, new CarrierTreeNodeComparitor() );
           return carrierList.iterator();
          }