开发者

Why use a bitwise AND here?

I wa开发者_开发技巧s reading through the hadoop code and found this line in a partitioner.

(key.hashCode() & Integer.MAX_VALUE) % numReduceTasks

Why are they using the bitwise AND?


To remove the sign bit. in the case that the hashCode is a negative number. its like Math.abs(key.hashCode())

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜