Let's say I have a list of fruits(and let's assume these fruits are in the database)
myList.add('Apple');
myList.add('Mango');
myList.add('Guava');
myList.add('Tomato');
myList.add('Dragon Fruit');
myList.add('Orange');
//More Fruits here
and let's say in my domain or data access object I have this
public List<String> listOfFruits(){
return myList;
}
Now let's assume that I have 1000 fruits and I called listOfFruits
of course it will load the whole list of fruits, and assuming that we have a thousand records of fruits therefore it will load and query of those fruits and it will /give performance impact,
now my question how can add a limit or offset in an arraylist when getting those fruits? I am currently making a pagination for this.