code: private void setArrayNodeID(int index, ArrayList<INode> array, INode node) {
          if (index < array.size()) {
              array.set(index, node);
          } else {
              array.add(index, node);
          }
      }
docs: Sets the node at a given position of the array.
  Changes the current value if there is one, if there is no value, adds a new one.
  
  @param index position to be filled
  @param array array to be modified
  @param node  value to be set