本文整理汇总了Java中android.support.v4.util.Pools.Pool类的典型用法代码示例。如果您正苦于以下问题:Java Pool类的具体用法?Java Pool怎么用?Java Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pool类属于android.support.v4.util.Pools包,在下文中一共展示了Pool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: threadSafeList
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
/**
* Returns a new thread safe {@link Pool} that never returns {@code null} and that contains
* {@link List Lists} of a specific generic type with the given maximum size.
*
* <p>If the pool is empty when {@link Pool#acquire()} is called, a new {@link List} will be
* created.
*
* @param <T> The type of object that the {@link List Lists} will contain.
*/
// Public API.
@SuppressWarnings("WeakerAccess")
public static <T> Pool<List<T>> threadSafeList(int size) {
return build(new SynchronizedPool<List<T>>(size), new Factory<List<T>>() {
@Override
public List<T> create() {
return new ArrayList<>();
}
}, new Resetter<List<T>>() {
@Override
public void reset(List<T> object) {
object.clear();
}
});
}
示例2: DecodePath
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public DecodePath(Class<DataType> dataClass, Class<ResourceType> resourceClass,
Class<Transcode> transcodeClass,
List<? extends ResourceDecoder<DataType, ResourceType>> decoders,
ResourceTranscoder<ResourceType, Transcode> transcoder, Pool<List<Exception>> listPool) {
this.dataClass = dataClass;
this.decoders = decoders;
this.transcoder = transcoder;
this.listPool = listPool;
failureMessage = "Failed DecodePath{" + dataClass.getSimpleName() + "->"
+ resourceClass.getSimpleName() + "->" + transcodeClass.getSimpleName() + "}";
}
示例3: LoadPath
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public LoadPath(Class<Data> dataClass, Class<ResourceType> resourceClass,
Class<Transcode> transcodeClass,
List<DecodePath<Data, ResourceType, Transcode>> decodePaths, Pool<List<Exception>> listPool) {
this.dataClass = dataClass;
this.listPool = listPool;
this.decodePaths = Preconditions.checkNotEmpty(decodePaths);
failureMessage = "Failed LoadPath{" + dataClass.getSimpleName() + "->"
+ resourceClass.getSimpleName() + "->" + transcodeClass.getSimpleName() + "}";
}
示例4: threadSafeList
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
/**
* Returns a new thread safe {@link Pool} that never returns {@code null} and that contains
* {@link List Lists} of a specific generic type with the given maximum size.
*
* <p>If the pool is empty when {@link Pool#acquire()} is called, a new {@link List} will be
* created.
*
* @param <T> The type of object that the {@link List Lists} will contain.
*/
public static <T> Pool<List<T>> threadSafeList(int size) {
return build(new SynchronizedPool<List<T>>(size), new Factory<List<T>>() {
@Override
public List<T> create() {
return new ArrayList<>();
}
}, new Resetter<List<T>>() {
@Override
public void reset(List<T> object) {
object.clear();
}
});
}
示例5: DecodePath
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public DecodePath(Class<DataType> dataClass, Class<ResourceType> resourceClass,
Class<Transcode> transcodeClass,
List<? extends ResourceDecoder<DataType, ResourceType>> decoders,
ResourceTranscoder<ResourceType, Transcode> transcoder, Pool<List<Throwable>> listPool) {
this.dataClass = dataClass;
this.decoders = decoders;
this.transcoder = transcoder;
this.listPool = listPool;
failureMessage = "Failed DecodePath{" + dataClass.getSimpleName() + "->"
+ resourceClass.getSimpleName() + "->" + transcodeClass.getSimpleName() + "}";
}
示例6: LoadPath
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public LoadPath(Class<Data> dataClass, Class<ResourceType> resourceClass,
Class<Transcode> transcodeClass,
List<DecodePath<Data, ResourceType, Transcode>> decodePaths, Pool<List<Throwable>> listPool) {
this.dataClass = dataClass;
this.listPool = listPool;
this.decodePaths = Preconditions.checkNotEmpty(decodePaths);
failureMessage = "Failed LoadPath{" + dataClass.getSimpleName() + "->"
+ resourceClass.getSimpleName() + "->" + transcodeClass.getSimpleName() + "}";
}
示例7: ModelLoaderRegistry
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public ModelLoaderRegistry(Pool<List<Exception>> exceptionListPool) {
this(new MultiModelLoaderFactory(exceptionListPool));
}
示例8: MultiModelLoaderFactory
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public MultiModelLoaderFactory(Pool<List<Exception>> exceptionListPool) {
this(exceptionListPool, DEFAULT_FACTORY);
}
示例9: build
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public <Model, Data> MultiModelLoader<Model, Data> build(
List<ModelLoader<Model, Data>> modelLoaders, Pool<List<Exception>> exceptionListPool) {
return new MultiModelLoader<>(modelLoaders, exceptionListPool);
}
示例10: MultiModelLoader
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
MultiModelLoader(List<ModelLoader<Model, Data>> modelLoaders,
Pool<List<Exception>> exceptionListPool) {
this.modelLoaders = modelLoaders;
this.exceptionListPool = exceptionListPool;
}
示例11: MultiFetcher
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
MultiFetcher(List<DataFetcher<Data>> fetchers, Pool<List<Exception>> exceptionListPool) {
this.exceptionListPool = exceptionListPool;
Preconditions.checkNotEmpty(fetchers);
this.fetchers = fetchers;
currentIndex = 0;
}
示例12: build
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
private static <T extends Poolable> Pool<T> build(Pool<T> pool, Factory<T> factory) {
return build(pool, factory, FactoryPools.<T>emptyResetter());
}
示例13: FactoryPool
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
FactoryPool(Pool<T> pool, Factory<T> factory, Resetter<T> resetter) {
this.pool = pool;
this.factory = factory;
this.resetter = resetter;
}
示例14: ModelLoaderRegistry
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public ModelLoaderRegistry(Pool<List<Throwable>> throwableListPool) {
this(new MultiModelLoaderFactory(throwableListPool));
}
示例15: MultiModelLoaderFactory
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public MultiModelLoaderFactory(Pool<List<Throwable>> throwableListPool) {
this(throwableListPool, DEFAULT_FACTORY);
}