巨耗内存的写法:


new Short(
pieceInShort(
player==0 ? node.location.x : width - 1 - node.location.x,
player==0 ? node.location.y : height - 1 - node.location.y,
node.pieceColor, node.piece.preDefinedIndex()
)
)



protected short pieceInShort(int x, int y, int player, int piece){
return (short)( (x + 8) << 11 | (y + 8) << 6 | player << 4 | piece );
}//end pieceInShort()

这段写法非常耗费内存,看似简单,实际执行了很长的语句。

? :的使用我觉得除了炫耀自己对java的癖好外,没有任何好处。

以后会优化的,我相信

在一本书看到:
使用 ? :比使用max 或min这样的函数要好!

我就觉得? : 很好,
有必要拿这个来炫耀吗?