private class IntegerCreator implements Creator<Integer> {
private int current = 0;
- @Override public Integer create() { return current++; }
- @Override public void destroy(Integer t) { t = 0; }
- @Override public boolean isValid(Integer t) { return (t & 0x1) == 0; }
- @Override public void reuse(Integer t) { }
+
+ @Override
+ public Integer create() {
+ return current++;
+ }
+
+ @Override
+ public void destroy(Integer t) {
+ t = 0;
+ }
+
+ @Override
+ public boolean isValid(Integer t) {
+ return (t & 0x1) == 0;
+ }
+
+ @Override
+ public void reuse(Integer t) {
+ }
}
private class CustomLogger implements Log {
@Override
- public void log(Object ... o) {
+ public void log(Object... o) {
for (Object item : o) {
sb.append(item.toString());
}
Pooled<Integer> gotten = intPool.get();
assertThat(gotten.content, is(0));
- // finalize that item, then check the next one to make sure we actually purged the odd numbers
+ // finalize that item, then check the next one to make sure we actually purged
+ // the odd numbers
gotten = intPool.get();
assertThat(gotten.content, is(2));
}
-
@Test
public void setMaxTest() {
Pool<Integer> intPool = new Pool<Integer>(new IntegerCreator());