Permalink
Browse files

replaced LinkedList.descendingIterator usage to support Android API<9.

  • Loading branch information...
1 parent 4b834b0 commit 239de3ac6f573638a2a88046e8f600b0184fc623 @ahmetb committed Aug 31, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/org/orman/mapper/EntityDependencyGraph.java
@@ -183,9 +183,12 @@ private Entity getEntityOfType(Class<?> c) {
public List<Entity> getDestroySchedule(){
// clone already arranged list in reverse order
List<Entity> schedule = new ArrayList<Entity>(nodes.size());
- Iterator<Node> reversed = nodes.descendingIterator();
- while (reversed.hasNext()) {
- schedule.add(reversed.next().entity);
+
+ // caution: O(N^2) time complexity but saves memory space
+ // the reason we don't use LinkedList.descendingIterator is,
+ // it is not implemented Android API<9.
+ for(int i = nodes.size()-1, j = 0; i >= 0; i--, j++){
+ schedule.add(j, nodes.get(i).entity);
}
return schedule;
}

0 comments on commit 239de3a

Please sign in to comment.