/**
  * Returns the list of pieces that are attacking the king of <code>color</code> or
  * <code>null</null> if king is not in check.
  *
  * @param color King's color.
  * @param toKing King's location on the board.
  * @return The list of pieces attacking king or <code>null</code> if not in check.
  */
 public List<Square> kingAttackers(Color color, Point toKing) {
   List<Square> result = null;
   final Color opponent = color.getOpponentColor();
   Iterator<Square> iter = getIterator(opponent);
   while (iter.hasNext()) {
     final Square square = iter.next();
     if (square.getPiece().isLegalMove(square.getPoint(), toKing, this)) {
       if (result == null) {
         result = new ArrayList<>();
       }
       result.add(square);
     }
   }
   return result;
 }