src/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -25,11 +25,11 @@
package sun.reflect.generics.reflectiveObjects;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Type;
-
+import java.util.Objects;
/**
* Implementation of GenericArrayType interface for core reflection.
*/
public class GenericArrayTypeImpl
@@ -79,20 +79,15 @@
@Override
public boolean equals(Object o) {
if (o instanceof GenericArrayType) {
GenericArrayType that = (GenericArrayType) o;
- Type thatComponentType = that.getGenericComponentType();
- return genericComponentType == null ?
- thatComponentType == null :
- genericComponentType.equals(thatComponentType);
+ return Objects.equals(genericComponentType, that.getGenericComponentType());
} else
return false;
}
@Override
public int hashCode() {
- return (genericComponentType == null) ?
- 0:
- genericComponentType.hashCode();
+ return Objects.hashCode(genericComponentType);
}
}