Code example for LinkedHashMap

0
import org.robolectric.shadows.ShadowContext; 
import org.robolectric.tester.android.content.pm.StubPackageManager; 
 
public class RobolectricPackageManager extends StubPackageManager { 
 
  private final Map<String, AndroidManifest> androidManifests = new LinkedHashMap<String, AndroidManifest>();
  private final Map<String, PackageInfo> packageInfos = new LinkedHashMap<String, PackageInfo>();
  private Map<Intent, List<ResolveInfo>> resolveInfoForIntent = new LinkedHashMap<Intent, List<ResolveInfo>>();
  private Map<ComponentName, ComponentState> componentList = new LinkedHashMap<ComponentName, ComponentState>();
  private Map<ComponentName, Drawable> drawableList = new LinkedHashMap<ComponentName, Drawable>();
  private Map<String, Boolean> systemFeatureList = new LinkedHashMap<String, Boolean>();
  private Map<IntentFilter, ComponentName> preferredActivities = new LinkedHashMap<IntentFilter, ComponentName>();
  private Map<Pair<String, Integer>, Drawable> drawables = new LinkedHashMap<Pair<String, Integer>, Drawable>();
 
  @Override 
  public PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException {
    if (packageInfos.containsKey(packageName)) {
      return packageInfos.get(packageName);
    } 
 
    throw new NameNotFoundException();