Class DiffListByArrayList<T extends Comparable<Integer>>
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.snapshot.DiffListByArrayList<T>
- Type Parameters:
T- Type of the object in the list
public class DiffListByArrayList<T extends Comparable<Integer>>
extends Object
implements DiffList<T>
Resizable-array implementation of the DiffList interface.
-
Field Summary
Fields inherited from interface org.apache.hadoop.hdfs.server.namenode.snapshot.DiffList
EMPTY_LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an element at the beginning of the list.booleanAdds an element at the end of the list.intbinarySearch(int i) Searches the list for the specified object using the binary search algorithm.get(int i) Returns the element at the specified position in this list.getMinListForRange(int startIndex, int endIndex, INodeDirectory dir) Returns the list of minimal list of elements need to combine to generate cumulative sum from startIndex to endIndex.booleanisEmpty()Returns true if this list contains no elements.iterator()remove(int i) Removes the element at the specified position in this list.intsize()Returns the number of elements in this list.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DiffListByArrayList
public DiffListByArrayList(int initialCapacity)
-
-
Method Details
-
get
Description copied from interface:DiffListReturns the element at the specified position in this list.- Specified by:
getin interfaceDiffList<T extends Comparable<Integer>>- Parameters:
i- index of the element to return- Returns:
- the element at the specified position in this list
-
isEmpty
public boolean isEmpty()Description copied from interface:DiffListReturns true if this list contains no elements.- Specified by:
isEmptyin interfaceDiffList<T extends Comparable<Integer>>- Returns:
- true if this list contains no elements
-
size
public int size()Description copied from interface:DiffListReturns the number of elements in this list.- Specified by:
sizein interfaceDiffList<T extends Comparable<Integer>>- Returns:
- the number of elements in this list.
-
remove
Description copied from interface:DiffListRemoves the element at the specified position in this list.- Specified by:
removein interfaceDiffList<T extends Comparable<Integer>>- Parameters:
i- the index of the element to be removed- Returns:
- the element previously at the specified position
-
addLast
Description copied from interface:DiffListAdds an element at the end of the list.- Specified by:
addLastin interfaceDiffList<T extends Comparable<Integer>>- Parameters:
t- element to be appended to this list- Returns:
- true, if insertion is successful
-
addFirst
Description copied from interface:DiffListAdds an element at the beginning of the list.- Specified by:
addFirstin interfaceDiffList<T extends Comparable<Integer>>- Parameters:
t- element to be added to this list
-
binarySearch
public int binarySearch(int i) Description copied from interface:DiffListSearches the list for the specified object using the binary search algorithm.- Specified by:
binarySearchin interfaceDiffList<T extends Comparable<Integer>>- Parameters:
i- key to be searched for- Returns:
- the index of the search key, if it is contained in the list otherwise, (-insertion point - 1).
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends Comparable<Integer>>
-
getMinListForRange
Description copied from interface:DiffListReturns the list of minimal list of elements need to combine to generate cumulative sum from startIndex to endIndex.- Specified by:
getMinListForRangein interfaceDiffList<T extends Comparable<Integer>>- Returns:
- list of T
-