本文整理汇总了Java中android.support.v4.util.Pools.Pool类的典型用法代码示例。如果您正苦于以下问题:Java Pool类的具体用法?Java Pool怎么用?Java Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pool类属于android.support.v4.util.Pools包,在下文中一共展示了Pool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
});
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:FactoryPools.java
示例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() + "}";
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:DecodePath.java
示例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() + "}";
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:LoadPath.java
示例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();
}
});
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:FactoryPools.java
示例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() + "}";
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:DecodePath.java
示例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() + "}";
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:LoadPath.java
示例7: ModelLoaderRegistry
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public ModelLoaderRegistry(Pool<List<Exception>> exceptionListPool) {
this(new MultiModelLoaderFactory(exceptionListPool));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ModelLoaderRegistry.java
示例8: MultiModelLoaderFactory
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public MultiModelLoaderFactory(Pool<List<Exception>> exceptionListPool) {
this(exceptionListPool, DEFAULT_FACTORY);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:MultiModelLoaderFactory.java
示例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);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MultiModelLoaderFactory.java
示例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;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:MultiModelLoader.java
示例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;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:MultiModelLoader.java
示例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());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:FactoryPools.java
示例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;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:FactoryPools.java
示例14: ModelLoaderRegistry
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public ModelLoaderRegistry(Pool<List<Throwable>> throwableListPool) {
this(new MultiModelLoaderFactory(throwableListPool));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ModelLoaderRegistry.java
示例15: MultiModelLoaderFactory
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public MultiModelLoaderFactory(Pool<List<Throwable>> throwableListPool) {
this(throwableListPool, DEFAULT_FACTORY);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:MultiModelLoaderFactory.java
示例16: build
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
public <Model, Data> MultiModelLoader<Model, Data> build(
List<ModelLoader<Model, Data>> modelLoaders, Pool<List<Throwable>> throwableListPool) {
return new MultiModelLoader<>(modelLoaders, throwableListPool);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MultiModelLoaderFactory.java
示例17: MultiModelLoader
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
MultiModelLoader(List<ModelLoader<Model, Data>> modelLoaders,
Pool<List<Throwable>> exceptionListPool) {
this.modelLoaders = modelLoaders;
this.exceptionListPool = exceptionListPool;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:MultiModelLoader.java
示例18: MultiFetcher
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
MultiFetcher(List<DataFetcher<Data>> fetchers, Pool<List<Throwable>> throwableListPool) {
this.throwableListPool = throwableListPool;
Preconditions.checkNotEmpty(fetchers);
this.fetchers = fetchers;
currentIndex = 0;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:MultiModelLoader.java
示例19: simple
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
/**
* Returns a non-thread safe {@link Pool} that never returns {@code null} from
* {@link Pool#acquire()} and that contains objects of the type created by the given
* {@link Factory} with the given maximum size.
*
* <p>If the pool is empty when {@link Pool#acquire()} is called, the given {@link Factory} will
* be used to create a new instance.
*
* @param <T> The type of object the pool will contains.
*/
public static <T extends Poolable> Pool<T> simple(int size, Factory<T> factory) {
return build(new SimplePool<T>(size), factory);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:FactoryPools.java
示例20: threadSafe
import android.support.v4.util.Pools.Pool; //导入依赖的package包/类
/**
* Returns a new thread safe {@link Pool} that never returns {@code null} from
* {@link Pool#acquire()} and that contains objects of the type created by the given
* {@link Factory} with the given maximum size.
*
* <p>If the pool is empty when {@link Pool#acquire()} is called, the given {@link Factory} will
* be used to create a new instance.
*
* @param <T> The type of object the pool will contains.
*/
public static <T extends Poolable> Pool<T> threadSafe(int size, Factory<T> factory) {
return build(new SynchronizedPool<T>(size), factory);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:FactoryPools.java
注:本文中的android.support.v4.util.Pools.Pool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论