sec lists /*array-based list implementation *class alist implements list private static final int defaultsize /default size private int maxsize/maximum size of list private int listsize/number of list items now private int curr/position of current element private [listarray/array holding list elements /*constructors */*create list with the default capacity *alist(this(defaultsize)/*create new list object @param size max number of elements list can contain *@suppresswarnings("unchecked"/generic array allocation alist(int sizemaxsize sizelistsize curr listarray ( [])new object[size]/create listarray public void clear(listsize curr /reinitialize the list /simply reinitialize values /*insert "itat current position *public void insert( itassert listsize maxsize "list capacity exceeded"for (int =listsizei>curri--/shift elements up listarray[ilistarray[ - ]/to make room listarray[curritlistsize++/increment list size public void append( it/append "itassert listsize maxsize "list capacity exceeded"listarray[listsize++it/remove and return the current element public remove(if ((curr=listsize)/no current element return nulle it listarray[curr]/copy the element for(int =curri<listsize- ++/shift them down listarray[ilistarray[ + ]listsize--/decrement size return itfigure an array-based list implementation