예제 #1
0
 /**
  * Finds a child object by its type. Note that this may invoke the class loader and therefore may
  * be slow.
  *
  * @param classObject The class type to search for (e.g. BaseObject.class).
  * @return
  */
 public <T> T findByClass(Class<T> classObject) {
   T object = null;
   final int count = mObjects.getCount();
   for (int i = 0; i < count; i++) {
     BaseObject currentObject = mObjects.get(i);
     if (currentObject.getClass() == classObject) {
       object = classObject.cast(currentObject);
       break;
     }
   }
   return object;
 }