/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2011 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */
package org.appcelerator.titanium;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * A registry for TiBaseActivity<->Window creation logic.
 */
public class TiActivityWindows
{
	protected static AtomicInteger windowIdGenerator = new AtomicInteger();
	protected static HashMap<Integer, TiActivityWindow> windows = new HashMap<Integer, TiActivityWindow>();

	public static int addWindow(TiActivityWindow window)
	{
		int windowId = windowIdGenerator.incrementAndGet();
		windows.put(windowId, window);
		return windowId;
	}

	public static void windowCreated(TiBaseActivity activity, int windowId)
	{
		TiActivityWindow window = windows.get(windowId);
		if (window != null) {
			window.windowCreated(activity);
			windows.remove(windowId);
		}
	}

	public static void removeWindow(int windowId) 
	{
		windows.remove(windowId);
	}
	
	public static void dispose()
	{
		windows.clear();
	}
}

@@ -271,34 +271,8 @@
 m;%0A%0A
-import java.util.HashMap;%0A
 impo
@@ -318,16 +318,50 @@
 teger;%0A%0A
+import android.util.SparseArray;%0A%0A
 /**%0A * A
@@ -542,33 +542,28 @@
  static 
-HashMap%3CInteger, 
+SparseArray%3C
 TiActivi
@@ -590,25 +590,20 @@
 new 
-HashMap%3CInteger, 
+SparseArray%3C
 TiAc

Use more efficent SparseArray.