Class SplitList<T>
- java.lang.Object
-
- org.daisy.dotify.common.collection.SplitList<T>
-
- Type Parameters:
T
- the type of objects in the lists
public class SplitList<T> extends Object
Provides a way to split a list into two parts around a given position.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>
getFirstPart()
Gets the first part of the original list.List<T>
getSecondPart()
Gets the second part of the original list.static <T> SplitList<T>
split(List<T> in, int pos)
Splits the list into two parts at the specified position.
-
-
-
Method Detail
-
getFirstPart
public List<T> getFirstPart()
Gets the first part of the original list.- Returns:
- returns the first part
-
getSecondPart
public List<T> getSecondPart()
Gets the second part of the original list.- Returns:
- returns the second part
-
split
public static <T> SplitList<T> split(List<T> in, int pos)
Splits the list into two parts at the specified position. The returned object is backed by the original list.- Type Parameters:
T
- The type of list- Parameters:
in
- the original listpos
- the position to split (must be >=0 && <=size())- Returns:
- returns the split list
-
-