From c13fc568c7cd11dbd53fb78e88479ef818c95cb3 Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Tue, 18 Aug 2009 18:07:25 +0000 Subject: [PATCH] Fixed indentation and simplified equals method as per code review comments on r419 --- .../main/java/com/google/gson/JsonPrimitive.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gson/src/main/java/com/google/gson/JsonPrimitive.java b/gson/src/main/java/com/google/gson/JsonPrimitive.java index bae2fc48..b053c66d 100644 --- a/gson/src/main/java/com/google/gson/JsonPrimitive.java +++ b/gson/src/main/java/com/google/gson/JsonPrimitive.java @@ -351,13 +351,16 @@ public final class JsonPrimitive extends JsonElement { @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } JsonPrimitive other = (JsonPrimitive)obj; if (value == null) { - if (other.value != null) return false; - } else if (!value.equals(other.value)) return false; - return true; + return other.value == null; + } + return value.equals(other.value); } }