class ArrayTypeAdapter<E> extends TypeAdapter<Object> {
  public static final TypeAdapterFactory FACTORY =
      new TypeAdapterFactory() {
        @Override
        public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
          Type type = typeToken.getType();
          if (!(type instanceof GenericArrayType
              || (type instanceof Class && ((Class<?>) type).isArray()))) {
            return null;
          }

          Type componentType = $Gson$Types.getArrayComponentType(type);
          TypeAdapter<?> componentTypeAdapter = gson.getAdapter(TypeToken.get(componentType));

          @SuppressWarnings({"unchecked", "rawtypes"})
          TypeAdapter<T> arrayAdapter =
              new ArrayTypeAdapter(
                  gson, componentTypeAdapter, $Gson$Types.getRawType(componentType));
          return arrayAdapter;
        }
      };

  private final Class<E> componentType;
  private final TypeAdapter<E> componentTypeAdapter;

  public ArrayTypeAdapter(
      Gson context, TypeAdapter<E> componentTypeAdapter, Class<E> componentType) {
    this.componentTypeAdapter =
        new TypeAdapterRuntimeTypeWrapper<>(context, componentTypeAdapter, componentType);
    this.componentType = componentType;
  }

  @Override
  public Object read(JsonReader in) throws IOException {<FILL_FUNCTION_BODY>}

  @Override
  public void write(JsonWriter out, Object array) throws IOException {
    if (array == null) {
      out.nullValue();
      return;
    }

    out.beginArray();
    for (int i = 0, length = Array.getLength(array); i < length; i++) {
      @SuppressWarnings("unchecked")
      E value = (E) Array.get(array, i);
      componentTypeAdapter.write(out, value);
    }
    out.endArray();
  }
}

    if (in.peek() == JsonToken.NULL) {
      in.nextNull();
      return null;
    }

    ArrayList<E> list = new ArrayList<>();
    in.beginArray();
    while (in.hasNext()) {
      E instance = componentTypeAdapter.read(in);
      list.add(instance);
    }
    in.endArray();

    int size = list.size();
    // Have to copy primitives one by one to primitive array
    if (componentType.isPrimitive()) {
      Object array = Array.newInstance(componentType, size);
      for (int i = 0; i < size; i++) {
        Array.set(array, i, list.get(i));
      }
      return array;
    }
    // But for Object[] can use ArrayList.toArray
    else {
      @SuppressWarnings("unchecked")
      E[] array = (E[]) Array.newInstance(componentType, size);
      return list.toArray(array);
    }
  
<methods>public void <init>() ,public final java.lang.Object fromJson(java.io.Reader) throws java.io.IOException,public final java.lang.Object fromJson(java.lang.String) throws java.io.IOException,public final java.lang.Object fromJsonTree(com.google.gson.JsonElement) ,public final TypeAdapter<java.lang.Object> nullSafe() ,public abstract java.lang.Object read(com.google.gson.stream.JsonReader) throws java.io.IOException,public final void toJson(java.io.Writer, java.lang.Object) throws java.io.IOException,public final java.lang.String toJson(java.lang.Object) ,public final com.google.gson.JsonElement toJsonTree(java.lang.Object) ,public abstract void write(com.google.gson.stream.JsonWriter, java.lang.Object) throws java.io.IOException<variables>