public static boolean valuesEqual(Value val1, Value val2) { if (val1 == null) { return val2 == null; } if (val2 == null) { return false; } if (val1 instanceof StringReference && val2 instanceof StringReference) { return ((StringReference) val1).value().equals(((StringReference) val2).value()); } return val1.equals(val2); }
@SuppressWarnings({"HardCodedStringLiteral"}) public static boolean isCharOrIntegerArray(Value value) { if (value == null) return false; if (myCharOrIntegers == null) { myCharOrIntegers = new HashSet<String>(); myCharOrIntegers.add("C"); myCharOrIntegers.add("B"); myCharOrIntegers.add("S"); myCharOrIntegers.add("I"); myCharOrIntegers.add("J"); } String signature = value.type().signature(); int i; for (i = 0; signature.charAt(i) == '['; i++) ; if (i == 0) return false; signature = signature.substring(i, signature.length()); return myCharOrIntegers.contains(signature); }