MCPcopy Index your code
hub / github.com/VolmitSoftware/Adapt / similar

Method similar

src/main/java/com/volmit/adapt/util/JSONArray.java:873–897  ·  view source on GitHub ↗

Determine if two JSONArrays are similar. They must contain similar sequences. @param other The other JSONArray @return true if they are equal

(Object other)

Source from the content-addressed store, hash-verified

871 * @return true if they are equal
872 */
873 public boolean similar(Object other) {
874 if (!(other instanceof JSONArray)) {
875 return false;
876 }
877 int len = this.length();
878 if (len != ((JSONArray) other).length()) {
879 return false;
880 }
881 for (int i = 0; i < len; i += 1) {
882 Object valueThis = this.get(i);
883 Object valueOther = ((JSONArray) other).get(i);
884 if (valueThis instanceof JSONObject) {
885 if (!((JSONObject) valueThis).similar(valueOther)) {
886 return false;
887 }
888 } else if (valueThis instanceof JSONArray) {
889 if (!((JSONArray) valueThis).similar(valueOther)) {
890 return false;
891 }
892 } else if (!valueThis.equals(valueOther)) {
893 return false;
894 }
895 }
896 return true;
897 }
898
899 /**
900 * Produce a JSONObject by combining a JSONArray of names with the values of

Callers

nothing calls this directly

Calls 4

lengthMethod · 0.95
getMethod · 0.95
getMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected