code: public static void scanForLeaves(List<RPNode> nodes,RPNode current) {
          if(current.getLeft() == null && current.getRight() == null)
              nodes.add(current);
          if(current.getLeft() != null)
              scanForLeaves(nodes,current.getLeft());
          if(current.getRight() != null)
              scanForLeaves(nodes,current.getRight());
      }
docs: Scan for leaves accumulating
  the nodes in the passed in list
  @param nodes the nodes so far