1 | if (this.allowDuplicateXValues) {↵ | | 1 | if (this.allowDuplicateXValues) {↵
|
2 | // need to make sure we are adding *after* any duplicates↵ | | 2 | // need to make sure we are adding *after* any duplicates↵
|
3 | int size = this.data.size();↵ | | 3 | int size = this.data.size();↵
|
4 | while (index < size ↵ | | 4 | while (index < size↵
|
5 | && item.compareTo(this.data.get(index)) == 0) {↵ | | 5 | && item.compareTo(this.data.get(index)) == 0) {↵
|
6 | index++;↵ | | 6 | index++;↵
|
7 | }↵ | | 7 | }↵
|
8 | if (index < this.data.size()) {↵ | | 8 | if (index < this.data.size()) {↵
|
9 | this.data.add(index, item);↵ | | 9 | this.data.add(index, item);↵
|
10 | }↵ | | 10 | }↵
|
11 | else {↵ | | 11 | else {↵
|
12 | this.data.add(item);↵ | | 12 | this.data.add(item);↵
|
13 | }↵ | | 13 | }↵
|
14 | }↵ | | 14 | }↵
|
15 | else {↵ | | 15 | else {↵
|
16 | throw new SeriesException("X-value already exists.");↵ | | 16 | throw new SeriesException("X-value already exists.");↵
|
17 | } | | 17 | }
|