cz.cuni.amis.utils.collections
Class ListConcatenation<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
cz.cuni.amis.utils.collections.ListConcatenation<T>
- All Implemented Interfaces:
- Iterable<T>, Collection<T>, List<T>
public class ListConcatenation<T>
- extends AbstractList<T>
An unmodifiable list that combines several child lists.
The list represent view on the underlying lists, so if they are modified,
so is this list. This class is not thread-safe (i.e. parallel modification to
underlying lists may cause unexpected behaviour)
- Author:
- Martin Cerny
Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
ListConcatenation
public ListConcatenation(List<List<T>> lists)
ListConcatenation
public ListConcatenation(List<T>... lists)
concatenate
public static <T> List<T> concatenate(List<T>... lists)
concatenate
public static <T> List<T> concatenate(List<List<T>> lists)
- Concatenates lists into the most simple form.
- Empty lists are ommitted
- If there is only one non-empty list, the list is returned, instead of concatenation
- If there is another ListConcatenation among parameters, it is expanded and its components are taken directly
- Type Parameters:
T
- - Parameters:
lists
-
- Returns:
get
public T get(int index)
- Specified by:
get
in interface List<T>
- Specified by:
get
in class AbstractList<T>
size
public int size()
- Specified by:
size
in interface Collection<T>
- Specified by:
size
in interface List<T>
- Specified by:
size
in class AbstractCollection<T>
Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.