Tree: Huffman Decoding

  • + 0 comments

    For point 1), that's a simple method call, inlined by the JVM if "hot":

    public int length() {
        return value.length;
    }
    

    For point 3), there is no computation for charAt method (except a check which is optimized by the JVM RangeCheckElemination & Co):

    public char charAt(int index) {
       if ((index < 0) || (index >= value.length)) {
           throw new StringIndexOutOfBoundsException(index);
      }
       return value[index];
    

    }