Add null check to merge methods, refactor code a bit.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1455703 13f79535-47bb-0310-9956-ffa450edef68
Fix checkstyle warning: argument hides field.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1455704 13f79535-47bb-0310-9956-ffa450edef68