code: public boolean nextBoolean() throws IOException {
      int p = peeked;
      if (p == PEEKED_NONE) {
        p = doPeek();
      }
      if (p == PEEKED_TRUE) {
        peeked = PEEKED_NONE;
        pathIndices[stackSize - 1]++;
        return true;
      } else if (p == PEEKED_FALSE) {
        peeked = PEEKED_NONE;
        pathIndices[stackSize - 1]++;
        return false;
      }
      throw new IllegalStateException("Expected a boolean but was " + peek() + locationString());
    }
docs: Returns the {@link com.google.gson.stream.JsonToken#BOOLEAN boolean} value of the next token,
  consuming it.
  
  @throws IllegalStateException if the next token is not a boolean or if
  this reader is closed.