com.g2forge.alexandria.adt.collection.strategy.ACollectionStrategy Maven / Gradle / Ivy
package com.g2forge.alexandria.adt.collection.strategy;
import java.util.Collection;
import com.g2forge.alexandria.adt.collection.collector.ICollectionBuilder;
import com.g2forge.alexandria.adt.collection.collector.implementations.CollectionCollectionBuilder;
public abstract class ACollectionStrategy, T> implements ICollectionStrategy {
protected class Builder extends CollectionCollectionBuilder {
public Builder() {
super(ACollectionStrategy.this.create(null));
}
@Override
public C get() {
return ACollectionStrategy.this.create(collection);
}
}
@Override
public ICollectionBuilder builder() {
return new Builder();
}
protected abstract C create(C copy);
@Override
public Iterable iterable(C collection) {
return collection;
}
}