Skip to content

Commit 965c288

Browse files
authored
Update DataStructure.java
1 parent 37b99ff commit 965c288

File tree

1 file changed

+44
-18
lines changed

1 file changed

+44
-18
lines changed

src/main/java/com/types/DataStructure.java

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,52 @@
66
* This interface is to define bacis functionality expected out of any implementation class
77
* Since this is a data structure it should have the flexibility to contain any kind of object hence it has been made generic
88
* 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+
*
910
* @param <T>
1011
*/
1112
public interface DataStructure<T> extends Iterator<T> {
1213

13-
//Method to add element in the structure
14-
public boolean add(T t);
15-
16-
//Method to remove the given object from structure
17-
public boolean remove(T o);
18-
19-
//Method to get Iterator to parse on the given structure
20-
public Iterator<T> iterator();
21-
22-
//Method to check if structure is empty
23-
public boolean isEmpty();
24-
25-
//Method to get all the elements of data structure in array
26-
public Object[] toArray();
27-
28-
//Method to get the size or number of elements in structure
29-
public int size();
30-
14+
/**
15+
* Method to add element in the structure
16+
*
17+
* @param t element
18+
* @return boolean
19+
*/
20+
boolean add(T t);
21+
22+
/**
23+
* Method to remove the given object from structure
24+
*
25+
* @param o element
26+
* @return boolean
27+
*/
28+
boolean remove(T o);
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+
boolean isEmpty();
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+
int size();
3157
}

0 commit comments

Comments
 (0)