|
6 | 6 | * This interface is to define bacis functionality expected out of any implementation class
|
7 | 7 | * Since this is a data structure it should have the flexibility to contain any kind of object hence it has been made generic
|
8 | 8 | * Any implementation class need not to be thread safe or it could be depending on the implementation class how does it want to behave.
|
| 9 | + * |
9 | 10 | * @param <T>
|
10 | 11 | */
|
11 | 12 | publicinterfaceDataStructure<T>extendsIterator<T> {
|
12 | 13 |
|
13 |
| -//Method to add element in the structure |
14 |
| -publicbooleanadd(Tt); |
15 |
| - |
16 |
| -//Method to remove the given object from structure |
17 |
| -publicbooleanremove(To); |
18 |
| - |
19 |
| -//Method to get Iterator to parse on the given structure |
20 |
| -publicIterator<T>iterator(); |
21 |
| - |
22 |
| -//Method to check if structure is empty |
23 |
| -publicbooleanisEmpty(); |
24 |
| - |
25 |
| -//Method to get all the elements of data structure in array |
26 |
| -publicObject[]toArray(); |
27 |
| - |
28 |
| -//Method to get the size or number of elements in structure |
29 |
| -publicintsize(); |
30 |
| - |
| 14 | +/** |
| 15 | + * Method to add element in the structure |
| 16 | + * |
| 17 | + * @param t element |
| 18 | + * @return boolean |
| 19 | + */ |
| 20 | +booleanadd(Tt); |
| 21 | + |
| 22 | +/** |
| 23 | + * Method to remove the given object from structure |
| 24 | + * |
| 25 | + * @param o element |
| 26 | + * @return boolean |
| 27 | + */ |
| 28 | +booleanremove(To); |
| 29 | + |
| 30 | +/** |
| 31 | + * Method to get Iterator to parse on the given structure |
| 32 | + * |
| 33 | + * @return iterator |
| 34 | + */ |
| 35 | +Iterator<T>iterator(); |
| 36 | + |
| 37 | +/** |
| 38 | + * Method to check if structure is empty |
| 39 | + * |
| 40 | + * @return boolean |
| 41 | + */ |
| 42 | +booleanisEmpty(); |
| 43 | + |
| 44 | +/** |
| 45 | + * Method to get all the elements of data structure in array |
| 46 | + * |
| 47 | + * @return arr |
| 48 | + */ |
| 49 | +Object[]toArray(); |
| 50 | + |
| 51 | +/** |
| 52 | + * Method to get the size or number of elements in structure |
| 53 | + * |
| 54 | + * @return size |
| 55 | + */ |
| 56 | +intsize(); |
31 | 57 | }
|