forked from JavaOPs/basejava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListSection.java
More file actions
50 lines (39 loc) · 1.13 KB
/
ListSection.java
File metadata and controls
50 lines (39 loc) · 1.13 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
44
45
46
47
48
49
50
package ru.javaops.webapp.model;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class ListSection extends Section {
private static final long serialVersionUID = 1L;
public static final ListSection EMPTY = new ListSection("");
private List<String> items;
public ListSection() {
}
public ListSection(String... items){
this(Arrays.asList(items));
}
public ListSection(List<String> items) {
Objects.requireNonNull(items, "items can't be NULL");
this.items = items;
}
public List<String> getItems() {
return items;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ListSection that = (ListSection) o;
return Objects.equals(items, that.items);
}
@Override
public int hashCode() {
return Objects.hash(items);
}
@Override
public String toString() {
return items.toString();
// return "ListSection{" +
// "items=" + items +
// '}';
}
}