I notice in the source code they are not used in critical loops, e.g.
in View.java :
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/view/ViewGroup.java;h=e686d1c20bd21eaa050ff3bf9187b549ee7b1355;hb=HEAD

I can see this kind of code which would be much easier implemented as
an ArrayList :

1867     private void addInArray(View child, int index) {
1868         View[] children = mChildren;
1869         final int count = mChildrenCount;
1870         final int size = children.length;
1871         if (index == count) {
1872             if (size == count) {
1873                 mChildren = new View[size +
ARRAY_CAPACITY_INCREMENT];
1874                 System.arraycopy(children, 0, mChildren, 0,
size);
1875                 children = mChildren;
1876             }
1877             children[mChildrenCount++] = child;
1878         } else if (index < count) {
1879             if (size == count) {
1880                 mChildren = new View[size +
ARRAY_CAPACITY_INCREMENT];
1881                 System.arraycopy(children, 0, mChildren, 0,
index);
1882                 System.arraycopy(children, index, mChildren,
index + 1, count - index);
1883                 children = mChildren;
1884             } else {
1885                 System.arraycopy(children, index, children, index
+ 1, count - index);
1886             }
1887             children[index] = child;
1888             mChildrenCount++;
1889         } else {
1890             throw new IndexOutOfBoundsException("index=" + index
+ " count=" + count);
1891         }
1892     }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to