diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index f2dbd14..e6a1441 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -211,10 +211,10 @@
      * Returns the array of the keys that are closest to the given point.
      * @param x the x-coordinate of the point
      * @param y the y-coordinate of the point
-     * @return the array of the nearest keys to the given point. If the given
+     * @return the list of the nearest keys to the given point. If the given
      * point is out of range, then an array of size zero is returned.
      */
-    public Key[] getNearestKeys(final int x, final int y) {
+    public List<Key> getNearestKeys(final int x, final int y) {
         // Avoid dead pixels at edges of the keyboard
         final int adjustedX = Math.max(0, Math.min(x, mOccupiedWidth - 1));
         final int adjustedY = Math.max(0, Math.min(y, mOccupiedHeight - 1));
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index a031669..3a4e335 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -22,9 +22,13 @@
 
 import com.android.inputmethod.keyboard.internal.TouchPositionCorrection;
 import com.android.inputmethod.latin.Constants;
+import com.android.inputmethod.latin.utils.CollectionUtils;
 import com.android.inputmethod.latin.utils.JniUtils;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 
 public class ProximityInfo {
     private static final String TAG = ProximityInfo.class.getSimpleName();
@@ -34,7 +38,7 @@
     public static final int MAX_PROXIMITY_CHARS_SIZE = 16;
     /** Number of key widths from current touch point to search for nearest keys. */
     private static final float SEARCH_DISTANCE = 1.2f;
-    private static final Key[] EMPTY_KEY_ARRAY = new Key[0];
+    private static final List<Key> EMPTY_KEY_LIST = Collections.emptyList();
     private static final float DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS = 0.15f;
 
     private final int mGridWidth;
@@ -48,7 +52,7 @@
     private final int mMostCommonKeyWidth;
     private final int mMostCommonKeyHeight;
     private final Key[] mKeys;
-    private final Key[][] mGridNeighbors;
+    private final List<Key>[] mGridNeighbors;
     private final String mLocaleStr;
 
     ProximityInfo(final String localeStr, final int gridWidth, final int gridHeight,
@@ -70,7 +74,7 @@
         mMostCommonKeyHeight = mostCommonKeyHeight;
         mMostCommonKeyWidth = mostCommonKeyWidth;
         mKeys = keys;
-        mGridNeighbors = new Key[mGridSize][];
+        mGridNeighbors = new List[mGridSize];
         if (minWidth == 0 || height == 0) {
             // No proximity required. Keyboard might be more keys keyboard.
             return;
@@ -110,14 +114,14 @@
     }
 
     private long createNativeProximityInfo(final TouchPositionCorrection touchPositionCorrection) {
-        final Key[][] gridNeighborKeys = mGridNeighbors;
+        final List<Key>[] gridNeighborKeys = mGridNeighbors;
         final int[] proximityCharsArray = new int[mGridSize * MAX_PROXIMITY_CHARS_SIZE];
         Arrays.fill(proximityCharsArray, Constants.NOT_A_CODE);
         for (int i = 0; i < mGridSize; ++i) {
-            final int proximityCharsLength = gridNeighborKeys[i].length;
+            final int proximityCharsLength = gridNeighborKeys[i].size();
             int infoIndex = i * MAX_PROXIMITY_CHARS_SIZE;
             for (int j = 0; j < proximityCharsLength; ++j) {
-                final Key neighborKey = gridNeighborKeys[i][j];
+                final Key neighborKey = gridNeighborKeys[i].get(j);
                 // Excluding from proximityCharsArray
                 if (!needsProximityInfo(neighborKey)) {
                     continue;
@@ -353,9 +357,13 @@
         }
 
         for (int i = 0; i < gridSize; ++i) {
-            final int base = i * keyCount;
-            mGridNeighbors[i] =
-                    Arrays.copyOfRange(neighborsFlatBuffer, base, base + neighborCountPerCell[i]);
+            final int indexStart = i * keyCount;
+            final int indexEnd = indexStart + neighborCountPerCell[i];
+            final ArrayList<Key> neighbords = CollectionUtils.newArrayList(indexEnd - indexStart);
+            for (int index = indexStart; index < indexEnd; index++) {
+                neighbords.add(neighborsFlatBuffer[index]);
+            }
+            mGridNeighbors[i] = Collections.unmodifiableList(neighbords);
         }
     }
 
@@ -369,7 +377,7 @@
         if (primaryKeyCode > Constants.CODE_SPACE) {
             dest[index++] = primaryKeyCode;
         }
-        final Key[] nearestKeys = getNearestKeys(x, y);
+        final List<Key> nearestKeys = getNearestKeys(x, y);
         for (Key key : nearestKeys) {
             if (index >= destLength) {
                 break;
@@ -385,9 +393,9 @@
         }
     }
 
-    public Key[] getNearestKeys(final int x, final int y) {
+    public List<Key> getNearestKeys(final int x, final int y) {
         if (mGridNeighbors == null) {
-            return EMPTY_KEY_ARRAY;
+            return EMPTY_KEY_LIST;
         }
         if (x >= 0 && x < mKeyboardMinWidth && y >= 0 && y < mKeyboardHeight) {
             int index = (y / mCellHeight) * mGridWidth + (x / mCellWidth);
@@ -395,6 +403,6 @@
                 return mGridNeighbors[index];
             }
         }
-        return EMPTY_KEY_ARRAY;
+        return EMPTY_KEY_LIST;
     }
 }
diff --git a/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java b/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
index e2fd390..ac7df30 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
@@ -29,6 +29,7 @@
 
 import java.util.ArrayDeque;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
@@ -216,9 +217,9 @@
     }
 
     @Override
-    public Key[] getNearestKeys(final int x, final int y) {
+    public List<Key> getNearestKeys(final int x, final int y) {
         // TODO: Calculate the nearest key index in mGridKeys from x and y.
-        return getKeys();
+        return Arrays.asList(getKeys());
     }
 
     static final class GridKey extends Key {
