Integer和Long不能直接equals比较会返回False
Long.class源码 public boolean equals(Object obj) { if (obj instanceof Long) { return this.value == (Long)obj; } else { return false; } } Integer.class源码 public boolean equals(Object obj) { if (obj instanceof Integer) { return this.value == (Integer)obj; } else { return false; } } 解决方法 Long变量.equals(Integer变量.longValue()) Integer变量.equals(Long变量.intValue()) Long.class源码 publ