/*
 * Copyright 2012 Kulikov Dmitriy
 * Copyright 2017 Nikita Shakarun
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package javax.microedition.util;

public class ArrayStack<E> {
	public static final int DELTA = 100;

	protected Object[] data;
	protected int index;

	public ArrayStack() {
		clear();
	}

	public void push(E value) {
		if (index >= data.length - 1) {
			Object[] temp = new Object[data.length + DELTA];
			System.arraycopy(data, 0, temp, 0, data.length);
			data = temp;
		}

		data[++index] = value;
	}

	public E pop() {
		if (index < 0) {
			return null;
		}

		return (E) data[index--];
	}

	public void clear() {
		data = new Object[0];
		index = -1;
	}
}

@@ -732,23 +732,21 @@
 00;%0A%0A%09pr
-otec
+iva
 te
-d
  Object%5B
@@ -760,15 +760,13 @@
 %0A%09pr
-otec
+iva
 te
-d
  int
@@ -816,24 +816,37 @@
 %09%7D%0A%0A%09public 
+synchronized 
 void push(E 
@@ -1050,16 +1050,29 @@
 %09public 
+synchronized 
 E pop() 
@@ -1153,16 +1153,29 @@
 %09public 
+synchronized 
 void cle

Fix for sticking virtual keys