
com.magictools.core.collection.RandomAccessPartition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magic-tools-all Show documentation
Show all versions of magic-tools-all Show documentation
magic-tools 是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
The newest version!
package com.magictools.core.collection;
import java.util.List;
import java.util.RandomAccess;
/**
* 列表分区或分段(可随机访问列表)
* 通过传入分区长度,将指定列表分区为不同的块,每块区域的长度相同(最后一块可能小于长度)
* 分区是在原List的基础上进行的,返回的分区是不可变的抽象列表,原列表元素变更,分区中元素也会变更。
* 参考:Guava的Lists#RandomAccessPartition
*
* @param 元素类型
* @author looly, guava
* @since 5.7.10
*/
public class RandomAccessPartition extends Partition implements RandomAccess {
/**
* 构造
*
* @param list 被分区的列表,必须实现{@link RandomAccess}
* @param size 每个分区的长度
*/
public RandomAccessPartition(List list, int size) {
super(list, size);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy