All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.res.android.ApkAssetsCookie Maven / Gradle / Ivy

There is a newer version: 4.14.1
Show newest version
package org.robolectric.res.android;

public class ApkAssetsCookie {

  public static final int kInvalidCookie = -1;
  public static final ApkAssetsCookie K_INVALID_COOKIE = new ApkAssetsCookie(kInvalidCookie);

  // hey memory/gc optimization!
  private static final ApkAssetsCookie[] PREBAKED = new ApkAssetsCookie[256];
  static {
    for (int i = 0; i < PREBAKED.length; i++) {
      PREBAKED[i] = new ApkAssetsCookie(i);
    }
  }

  public static ApkAssetsCookie forInt(int cookie) {
    if (cookie == kInvalidCookie) {
      return K_INVALID_COOKIE;
    }
    return PREBAKED[cookie];
  }

  private final int cookie;

  private ApkAssetsCookie(int cookie) {
    this.cookie = cookie;
  }

  public int intValue() {
    return cookie;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy