Package pro.horde.os.cutils.collection
Class ListPartition<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<List<? super T>>
-
- pro.horde.os.cutils.collection.ListPartition<T>
-
- All Implemented Interfaces:
Iterable<List<? super T>>,Collection<List<? super T>>,List<List<? super T>>
public final class ListPartition<T> extends AbstractList<List<? super T>>
This class provide a means to partition List into List of sublist.- Since:
- v1.0
- Author:
- Szymon Stepniak, Bobai Kato
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)List<T>get(int index)inthashCode()ListPartition<T>into(int sublistSize)Method used to get partition size.static <T> ListPartition<T>of(List<? extends T> list)Method to receive the list to be partitioned.intsize()-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
of
public static <T> ListPartition<T> of(List<? extends T> list)
Method to receive the list to be partitioned.- Type Parameters:
T- List type- Parameters:
list- List to be partitioned.- Returns:
- instance of
ListPartition
-
into
public ListPartition<T> into(int sublistSize)
Method used to get partition size.- Parameters:
sublistSize- The sub-list/ListPartition size.- Returns:
- current instance of
ListPartition
-
size
public int size()
- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceList<T>- Specified by:
sizein classAbstractCollection<List<? super T>>
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<T>- Specified by:
equalsin interfaceList<T>- Overrides:
equalsin classAbstractList<List<? super T>>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<T>- Specified by:
hashCodein interfaceList<T>- Overrides:
hashCodein classAbstractList<List<? super T>>
-
-