int (String scope1, String scope2) { final int key1 = getKey(scope1); final int key2 = getKey(scope2); if (key1 == -1 && key2 == -1) return scope1.compareTo(scope2); return Integer.compare(key1, key2); }