Created
September 16, 2016 01:33
-
-
Save jjlumagbas/d46ddb9fe99a33bf70e4477865245600 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AList { | |
| private String[] items; | |
| private int count; | |
| public AList() { | |
| items = new String[10]; | |
| count = 0; | |
| } | |
| public void add(String item) { | |
| items[count++] = item; | |
| } | |
| public void add(int i, String item) { | |
| items[i] = item; | |
| count++; | |
| } | |
| public String get(int i) { | |
| if (count == 0 || i >= count) { | |
| throw new IndexOutOfBoundsException(); | |
| } | |
| return items[i]; | |
| } | |
| public void remove(int i) { | |
| count--; | |
| } | |
| public void set(int i, String item) { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment