1 |
|
/* |
2 |
|
* Written by Doug Lea and Josh Bloch with assistance from members of |
3 |
|
* JCP JSR-166 Expert Group and released to the public domain, as |
4 |
< |
* explained at http://creativecommons.org/licenses/publicdomain |
4 |
> |
* explained at http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
import java.util.*; |
7 |
|
|
113 |
|
boolean prePresent = s.contains(e); |
114 |
|
boolean added = s.add(e); |
115 |
|
if (!s.contains(e)) |
116 |
< |
fail ("Element not present after addition."); |
116 |
> |
fail("Element not present after addition."); |
117 |
|
if (added == prePresent) |
118 |
< |
fail ("added == alreadyPresent"); |
118 |
> |
fail("added == alreadyPresent"); |
119 |
|
int postSize = s.size(); |
120 |
|
if (added && preSize == postSize) |
121 |
< |
fail ("Add returned true, but size didn't change."); |
121 |
> |
fail("Add returned true, but size didn't change."); |
122 |
|
if (!added && preSize != postSize) |
123 |
< |
fail ("Add returned false, but size changed."); |
123 |
> |
fail("Add returned false, but size changed."); |
124 |
|
} |
125 |
|
} |
126 |
|
|