ormliteforeign-collection

ORMLite foreigncollection - object searching


I'm using ORMLite & SQLite as my database, and I'm working on a android app.

1) I'm searching for a particular object in the Foreign-Collection object as follows.

Collection<PantryCheckLine> pantryCheckLinesCollection = pantryCheck.getPantryCheckLines();
Iterator iterator = pantryCheckLinesCollection.iterator();
while (iterator.hasNext()) {
    pantryCheckLine = (PantryCheckLine) iterator.next();
    //i'm searching for a purticular object match   
}

2) Or else I can directly query from the relevant table and identified the item as well.

What I'm asking is out of these two methods which one will be much faster?


Solution

  • Depends a bit on the particulars of your situation.