我在以下代码中遇到空指针异常,我试图将“newColumn”引用的对象添加到 Java 中“this.neighborColumns”引用的 ArrayList。我在这里先向您的帮助表示感谢。
for (int column = xInitial; column < xFinal; ++column)
{
for (int row = yInitial; row < yFinal; ++row)
{
// TODO: To make inhibition a circle around input column, change
// to remove conners of this rectangle inhibition
Column newColumn = this.region.getColumn(column, row);
if (newColumn != null)
{
this.neighborColumns.add(newColumn);
}
}
}