public void longToken(long tok) { if (isStackHash()) { getStackHash().put(currentKey, new Double(tok)); <<< not new Double, should be new Long(tok) currentKey = null; } else { getStackVec().add(new Long(tok)); } }