Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup #2282

Merged
merged 22 commits into from
Dec 13, 2022
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4685531
Simplify `if` condition in JsonReader.peekNumber()
MaicolAntali Dec 11, 2022
63aefb5
Remove `if` to simplify a `return` in Excluder.excludeClassChecks()
MaicolAntali Dec 11, 2022
97ceee9
Remove redundant variable in Gson.fromJson()
MaicolAntali Dec 11, 2022
0a792e9
equal condition replace by `Objects.equals()` in $Gson$Types.equal()
MaicolAntali Dec 11, 2022
1c3427b
equal condition replace by `Objects.equals()` in LinkedTreeMap.equal()
MaicolAntali Dec 11, 2022
99e8327
Replace `switch` with `if` in UtcDateTypeAdapter.read()
MaicolAntali Dec 11, 2022
a5f20c0
Remove redundant `throws` clause in GraphAdapterBuilder.read()
MaicolAntali Dec 11, 2022
aaad72f
Remove redundant `throws` clause in JsonTreeReader.UNREADABLE_READER
MaicolAntali Dec 11, 2022
a9b4e95
Remove redundant `throws` clause in JsonTreeWriter.UNREADABLE_READER
MaicolAntali Dec 11, 2022
b998890
Remove unnecessary `.initCause()` call
MaicolAntali Dec 11, 2022
3d577f3
Remove redundant cast in TreeTypeAdapter.GsonContextImpl.deserialize
MaicolAntali Dec 11, 2022
14291de
Replace `StringBuilder` with `String`
MaicolAntali Dec 11, 2022
7d3753d
Fix the import and restore the `switch`
MaicolAntali Dec 12, 2022
aba8387
Fix the import
MaicolAntali Dec 12, 2022
e8ec4d3
Add the `util.Objects` import
MaicolAntali Dec 12, 2022
b881da6
Fix indentation
MaicolAntali Dec 12, 2022
9856a94
Add a comment to clarify the condition
MaicolAntali Dec 12, 2022
c5d809a
Fix indentation
MaicolAntali Dec 12, 2022
a3b02c0
Fix imports
MaicolAntali Dec 12, 2022
db0ef3d
Fix indentation
MaicolAntali Dec 12, 2022
fa2dd8c
Fix indentation
MaicolAntali Dec 12, 2022
d7eef65
Fix indentation
MaicolAntali Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
equal condition replace by Objects.equals() in LinkedTreeMap.equal()
  • Loading branch information
MaicolAntali committed Dec 11, 2022
commit 1c3427b2c1b2d003668ed36831372ec8df4be02f
11 changes: 2 additions & 9 deletions gson/src/main/java/com/google/gson/internal/LinkedTreeMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.*;

/**
* A map of comparable keys to values. Unlike {@code TreeMap}, this class uses
Expand Down Expand Up @@ -227,7 +220,7 @@ Node<K, V> findByEntry(Entry<?, ?> entry) {
}

private boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
return Objects.equals(a, b);
}

/**
Expand Down