docs: public synchronized boolean validate(java.io.PrintStream printStream)
                      throws ObjectManagerException
      {
          if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
              trace.entry(this,
                          cclass,
                          "validate",
                          new Object[] { printStream });
  
          boolean valid = true; // Until proven otherwise.
  
          int logSizePlus1 = 0;
          for (long sizePlus1 = size + 1; sizePlus1 != 0; sizePlus1 = sizePlus1 >>> 1) {
              logSizePlus1++;
          } // for...
          int maximumLeafDepth = (int) (2 * logSizePlus1);
          int firstBlackDepth = 0;
          long numberFound = 0;
  
          Iterator iterator = entrySet().iterator();
          Entry previous = null;
          if (iterator.hasNext()) {
              numberFound++;
              previous = (Entry) iterator.next();
          } // if (iterator.hasNext()). 
          while (iterator.hasNext()) {
              numberFound++;
              Entry entry = (Entry) iterator.next();
  
              // Check keys are returned in the sort order.
              if (compare(entry.getKey(), previous.getKey()) < 0) {
                  valid = false;
                  printStream.println("key=" + previous.getKey() + " < following key=" + entry.getKey());
              } // if (compare... 
              previous = entry;
  
              // Check that a RED node has two BLACK/Null children.
              if (entry.getColor()) {
                  if ((entry.getLeft() != null && entry.getLeft().getColor())
                      || (entry.getRight() != null && entry.getRight().getColor())) {
                      printStream.println((indexLabel(entry) + "                    ").substring(0, 20)
                                          + " Key=" + entry.getKey() + " Value=" + entry.getValue()
                                          + " Red node without two BLACK/null chideren left=" + entry.getLeft() + " right=" + entry.getRight());
                  }
              } // if (entry.getColor())
  
              // Check tree is balanced, all leaf nodes must have the same number 
              // of BLACK nodes between themselves and the root. No leaf may be more
              // than 2*Log2(size+1) nodes from the root. 
              if (entry.getLeft() == null || entry.getRight() == null) {
                  int blackDepth = 0;
                  int depth = 0;
                  for (Entry parent = entry; parent != getRoot(); parent = (Entry) parent.getParent()) {
                      depth++;
                      if (!parent.getColor())
                          blackDepth++;
                  } // for... 
                  if (firstBlackDepth == 0)
                      firstBlackDepth = blackDepth;
  
                  if (depth > maximumLeafDepth) {
                      valid = false;
                      printStream.println((indexLabel(entry) + "                    ").substring(0, 20)
                                          + " Key=" + entry.getKey() + " Value=" + entry.getValue()
                                          + " Leaf depth=" + depth + ">" + maximumLeafDepth);
                  } // if if (depth > maximumLeafDepth ).
  
                  if (blackDepth != firstBlackDepth) {
                      valid = false;
                      printStream.println((indexLabel(entry) + "                    ").substring(0, 20)
                                          + " Key=" + entry.getKey() + " Value=" + entry.getValue()
                                          + " blackDepth=" + blackDepth + " != " + firstBlackDepth);
                  } // if if (depth > maximumLeafDepth ).
              }
          } // while... 
  
          if (numberFound != size())
              printStream.println(" Number of Entries found=" + numberFound + " != size()" + size());
  
          if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
              trace.exit(this,
                         cclass,
                         "validate",
                         new Object[] { new Boolean(valid) });
          return valid;
      }