I am using an ArrayList within my code which gets populated by a EditText field but I am wanting to limit the ArrayList so it can only
ArrayList
EditText
If you don't have control over the function that adds elements to the list, you might want to override the ArrayList add.
add
public class MySizeLimitedArrayList extends ArrayList { @Override public boolean add(Object e) { if (this.size() < 10) { return super.add(e); } return false; } }