E - public class BitList<E> extends AbstractList<E>
originList: Initial elements of the list. This list will not be changed in modification actions (expect clear all). rootSet: A bitMap to store the indexes of originList are still exist. Most of the modification actions are operated on this bitMap. tailList: An additional list for BitList. Worked when adding totally new elements to list. These elements will be appended to the last of the BitList.
An example of BitList: originList: A B C D E (5 elements) rootSet: x v x v v 0 1 0 1 1 (5 elements) tailList: F G H (3 elements) resultList: B D E F G H (6 elements)
| 限定符和类型 | 类和说明 |
|---|---|
static class |
BitList.BitListIterator<E> |
| 构造器和说明 |
|---|
BitList(List<E> originList) |
BitList(List<E> originList,
BitSet rootSet,
List<E> tailList) |
BitList(List<E> originList,
boolean empty) |
BitList(List<E> originList,
boolean empty,
List<E> tailList) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e)
If the element to added is appeared in originList even if it is not in rootSet,
directly set its index in rootSet to true.
|
boolean |
addAll(Collection<? extends E> c) |
void |
addIndex(int index) |
void |
addToTailList(E e) |
BitList<E> |
and(BitList<E> target)
And operation between two bitList.
|
void |
clear()
Caution: This operation will clear originList for removing references purpose.
|
BitList<E> |
clone() |
ArrayList<E> |
cloneToArrayList() |
boolean |
contains(Object o) |
static <T> BitList<T> |
emptyList() |
E |
get(int index) |
E |
getByIndex(int index) |
List<E> |
getOriginList() |
List<E> |
getTailList() |
boolean |
hasMoreElementInTailList() |
boolean |
indexExist(int index) |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
BitList<E> |
or(BitList<E> target) |
E |
randomSelectOne() |
E |
remove(int index) |
boolean |
remove(Object o)
If the element to added is appeared in originList,
directly set its index in rootSet to false.
|
int |
size() |
BitList<E> |
subList(int fromIndex,
int toIndex) |
int |
totalSetSize() |
containsAll, removeAll, retainAll, toArray, toArray, toStringcontainsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic void addIndex(int index)
public int totalSetSize()
public boolean indexExist(int index)
public E getByIndex(int index)
public BitList<E> and(BitList<E> target)
target - target bitListpublic boolean hasMoreElementInTailList()
public void addToTailList(E e)
public E randomSelectOne()
public static <T> BitList<T> emptyList()
public int size()
size 在接口中 Collection<E>size 在接口中 List<E>size 在类中 AbstractCollection<E>public boolean contains(Object o)
contains 在接口中 Collection<E>contains 在接口中 List<E>contains 在类中 AbstractCollection<E>public boolean add(E e)
If the element is not contained in originList, allocate tailList and add to tailList.
Notice: It is not recommended adding duplicated element.
add 在接口中 Collection<E>add 在接口中 List<E>add 在类中 AbstractList<E>public boolean remove(Object o)
If the element is not contained in originList, try to remove from tailList.
remove 在接口中 Collection<E>remove 在接口中 List<E>remove 在类中 AbstractCollection<E>public void clear()
clear 在接口中 Collection<E>clear 在接口中 List<E>clear 在类中 AbstractList<E>public boolean addAll(Collection<? extends E> c)
addAll 在接口中 Collection<E>addAll 在接口中 List<E>addAll 在类中 AbstractCollection<E>public int lastIndexOf(Object o)
lastIndexOf 在接口中 List<E>lastIndexOf 在类中 AbstractList<E>public boolean isEmpty()
isEmpty 在接口中 Collection<E>isEmpty 在接口中 List<E>isEmpty 在类中 AbstractCollection<E>public ListIterator<E> listIterator()
listIterator 在接口中 List<E>listIterator 在类中 AbstractList<E>public ListIterator<E> listIterator(int index)
listIterator 在接口中 List<E>listIterator 在类中 AbstractList<E>Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.