-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestionList.java
More file actions
43 lines (36 loc) · 1.14 KB
/
Copy pathQuestionList.java
File metadata and controls
43 lines (36 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package interviews;
import java.util.Set;
import java.util.HashSet;
public class QuestionList implements IQuestionList {
// #region members
protected Set<Question> innerList;
// #endregion
// #region constructor
public QuestionList() {
innerList = new HashSet<Question>();
}
// #endregion
// #region IQuestionList implementation
public void Add(Question q) {
innerList.add(q);
}
public int Size(){
return innerList.size();
}
/**
* parameters are ignored in the search if experience: NONE, language: empty or
* null, duration: null
*/
public Set<Question> Search(Experience exp, String language, Integer duration) {
Set<Question> result = new HashSet<Question>();
for (Question var : innerList) {
if ((exp == Experience.NONE || exp == var.experience)
&& (language == null || language.length() == 0 || language.equalsIgnoreCase(var.language))
&& (duration == null || duration == var.duration)) {
result.add(var);
}
}
return result;
}
// #endregion
}