Class CharsRef

    • Field Detail


        public static final char[] EMPTY_CHARS
        An empty character array for convenience
      • chars

        public char[] chars
        The contents of the CharsRef. Should never be null.
      • offset

        public int offset
        Offset of first valid character.
      • length

        public int length
        Length of used characters.
    • Constructor Detail

      • CharsRef

        public CharsRef()
        Creates a new CharsRef initialized an empty array zero-length
      • CharsRef

        public CharsRef​(int capacity)
        Creates a new CharsRef initialized with an array of the given capacity
      • CharsRef

        public CharsRef​(char[] chars,
                        int offset,
                        int length)
        Creates a new CharsRef initialized with the given array, offset and length
      • CharsRef

        public CharsRef​(String string)
        Creates a new CharsRef initialized with the given Strings character array
    • Method Detail

      • hashCode

        public int hashCode()
        hashCode in class Object
      • stringHashCode

        public static int stringHashCode​(char[] chars,
                                         int offset,
                                         int length)
        the hash code of the given char sub-array, calculated by String.hashCode() specification
      • charsEquals

        public boolean charsEquals​(CharsRef other)
      • charAt

        public char charAt​(int index)
        Specified by:
        charAt in interface CharSequence
      • getUTF16SortedAsUTF8Comparator

        public static Comparator<CharsRef> getUTF16SortedAsUTF8Comparator()
        This comparator is only a transition mechanism
      • deepCopyOf

        public static CharsRef deepCopyOf​(CharsRef other)
        Creates a new CharsRef that points to a copy of the chars from other

        The returned CharsRef will have a length of other.length and an offset of zero.

      • isValid

        public boolean isValid()
        Performs internal consistency checks. Always returns true (or throws IllegalStateException)