Package org.qiunet.utils.collection.safe
Class SafeList<E>
java.lang.Object
org.qiunet.utils.collection.safe.SafeList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,ISafeCollection
- Direct Known Subclasses:
IntegerList,LongList,StringList
不改变类的情况下. 将集合可以定义为不可修改的集合.
* 用于配置等地方.
- Author:
- qiunet Created on 17/3/1 16:28.
-
Constructor Summary
ConstructorsConstructorDescriptionSafeList()SafeList(int initialCapacity) 指定一个初始化大小的listSafeList(Collection<? extends E> c) -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> c) booleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) void将集合转为安全集合.get(int index) intbooleanisEmpty()iterator()intlistIterator(int index) remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()subList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
Constructor Details
-
SafeList
public SafeList() -
SafeList
public SafeList(int initialCapacity) 指定一个初始化大小的list- Parameters:
initialCapacity-
-
SafeList
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
subList
-
convertToUnmodifiable
public void convertToUnmodifiable()Description copied from interface:ISafeCollection将集合转为安全集合. 不可写.- Specified by:
convertToUnmodifiablein interfaceISafeCollection
-