File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
libraries/core/src/main/java/net/ornithemc/osl/core/api/util Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 11package net .ornithemc .osl .core .api .util ;
22
3+ import java .util .Comparator ;
4+
35import net .ornithemc .osl .core .impl .util .NamespacedIdentifierException ;
46import net .ornithemc .osl .core .impl .util .NamespacedIdentifierParseException ;
57import net .ornithemc .osl .core .impl .util .NamespacedIdentifierImpl ;
@@ -28,6 +30,18 @@ public final class NamespacedIdentifiers {
2830 */
2931 public static final int MAX_LENGTH_IDENTIFIER = Integer .MAX_VALUE ;
3032
33+ /**
34+ * A comparator for {@code NamespacedIdentifier}s, comparing first by identifier, then by namespace.
35+ */
36+ public static final Comparator <NamespacedIdentifier > COMPARATOR = (a , b ) -> {
37+ int c = a .identifier ().compareTo (b .identifier ());
38+ if (c == 0 ) {
39+ c = a .namespace ().compareTo (b .namespace ());
40+ }
41+
42+ return c ;
43+ };
44+
3145 /**
3246 * Construct and validate a {@code NamespacedIdentifier} with the default namespace and the given identifier.
3347 *
You can’t perform that action at this time.
0 commit comments