@Override public String toString(){
  StringBuilder stringBuilder=new StringBuilder("Parents: [");
  for (  NodeCollection parent : parents) {
    stringBuilder.append(parent.getId() + " ");
  }
  stringBuilder.append("];Children: [");
  for (  NodeCollection child : children) {
    stringBuilder.append(child.getId() + " ");
  }
  stringBuilder.append("]");
  return stringBuilder.toString();
}

@ Override public String toString ( ) { StringBuilder stringBuilder = new StringBuilder ( "Parents: [" ) ; for ( NodeCollection parent : parents ) { stringBuilder . append ( parent . getId ( ) + " " ) ; } stringBuilder . append ( "];Children: [" ) ; for ( NodeCollection child : children ) { stringBuilder . append ( child . getId ( ) + " " ) ; } stringBuilder . append ( "]" ) ; return stringBuilder . toString ( ) ; }
method tostring ( ) used to format the string to be returned . ex . parents : [ 1 ] children : [ 2 , 3 ] would be the string returned for a process with process id having 2 children having ids 2 and 3
