com.g2forge.alexandria.adt.collection.strategy.ACollectionStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ax-collection Show documentation
Show all versions of ax-collection Show documentation
Extended collection API, which will evolve to encompass all ADTs.
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 create() {
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;
}
}