content: /*
   * Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
   */
  package com.google.gson;
  
  import com.google.gson.JsonElement;
  import com.google.gson.JsonNull;
  import com.google.gson.JsonPrimitive;
  import java.math.BigDecimal;
  import java.math.BigInteger;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  public final class JsonArray
  extends JsonElement
  implements Iterable<JsonElement> {
      private final List<JsonElement> elements;
  
      public JsonArray() {
          this.elements = new ArrayList<JsonElement>();
      }
  
      public JsonArray(int capacity) {
          this.elements = new ArrayList<JsonElement>(capacity);
      }
  
      @Override
      public JsonArray deepCopy() {
          if (!this.elements.isEmpty()) {
              JsonArray result = new JsonArray(this.elements.size());
              for (JsonElement element : this.elements) {
                  result.add(element.deepCopy());
              }
              return result;
          }
          return new JsonArray();
      }
  
      public void add(Boolean bool) {
          this.elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool));
      }
  
      public void add(Character character) {
          this.elements.add(character == null ? JsonNull.INSTANCE : new JsonPrimitive(character));
      }
  
      public void add(Number number) {
          this.elements.add(number == null ? JsonNull.INSTANCE : new JsonPrimitive(number));
      }
  
      public void add(String string) {
          this.elements.add(string == null ? JsonNull.INSTANCE : new JsonPrimitive(string));
      }
  
      public void add(JsonElement element) {
          if (element == null) {
              element = JsonNull.INSTANCE;
          }
          this.elements.add(element);
      }
  
      public void addAll(JsonArray array) {
          this.elements.addAll(array.elements);
      }
  
      public JsonElement set(int index, JsonElement element) {
          return this.elements.set(index, element);
      }
  
      public boolean remove(JsonElement element) {
          return this.elements.remove(element);
      }
  
      public JsonElement remove(int index) {
          return this.elements.remove(index);
      }
  
      public boolean contains(JsonElement element) {
          return this.elements.contains(element);
      }
  
      public int size() {
          return this.elements.size();
      }
  
      @Override
      public Iterator<JsonElement> iterator() {
          return this.elements.iterator();
      }
  
      public JsonElement get(int i) {
          return this.elements.get(i);
      }
  
      @Override
      public Number getAsNumber() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsNumber();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public String getAsString() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsString();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public double getAsDouble() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsDouble();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public BigDecimal getAsBigDecimal() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsBigDecimal();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public BigInteger getAsBigInteger() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsBigInteger();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public float getAsFloat() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsFloat();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public long getAsLong() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsLong();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public int getAsInt() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsInt();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public byte getAsByte() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsByte();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public char getAsCharacter() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsCharacter();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public short getAsShort() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsShort();
          }
          throw new IllegalStateException();
      }
  
      @Override
      public boolean getAsBoolean() {
          if (this.elements.size() == 1) {
              return this.elements.get(0).getAsBoolean();
          }
          throw new IllegalStateException();
      }
  
      public boolean equals(Object o) {
          return o == this || o instanceof JsonArray && ((JsonArray)o).elements.equals(this.elements);
      }
  
      public int hashCode() {
          return this.elements.hashCode();
      }
  }
  
  