Package generic.stl
Class VectorSTL<T>
java.lang.Object
generic.stl.VectorSTL<T>
- All Implemented Interfaces:
Iterable<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
back()
begin()
void
clear()
copy()
boolean
empty()
end()
boolean
erase
(int index) erase
(IteratorSTL<T> it) void
erase
(IteratorSTL<T> start, IteratorSTL<T> end) front()
get
(int index) void
void
insert
(IteratorSTL<T> iterator, T value) void
insert
(IteratorSTL<T> pos, T[] list) void
insertAll
(IteratorSTL<T> pos, VectorSTL<T> vector) iterator()
lower_bound
(T key) Returns an iterator postioned at the item in the vector that is the smallest key less or equal than the given key.lower_bound
(T key, Comparator<T> comparator) Returns an iterator postioned at the item in the vector that is the smallest key less or equal than the given key.static <K> void
static <K> void
merge
(VectorSTL<K> v1, VectorSTL<K> v2, VectorSTL<K> destination, Comparator<K> comparator) pop_back()
void
rBegin()
rEnd()
void
reserve
(int capacity) void
void
void
set
(IteratorSTL<T> iter, T value) void
int
size()
void
sort()
Sorts the vector.void
sort
(Comparator<T> comparator) toString()
upper_bound
(T key) Returns an iterator postioned at the item in the vector that is the smallest key less than the given key.upper_bound
(T key, Comparator<T> comparator) Returns an iterator postioned at the item in the vector that is the smallest key less than the given key.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
VectorSTL
public VectorSTL() -
VectorSTL
public VectorSTL(int initialCapacity) -
VectorSTL
-
VectorSTL
-
-
Method Details
-
toString
-
reserve
public void reserve(int capacity) -
begin
-
end
-
rBegin
-
rEnd
-
clear
public void clear() -
size
public int size() -
empty
public boolean empty() -
get
-
front
-
back
-
setBack
-
push_back
-
pop_back
-
insert
-
appendAll
-
insertAll
-
insert
-
set
-
set
-
equals
-
erase
-
erase
-
erase
-
sort
public void sort()Sorts the vector. To use this method T must be comparable.- Throws:
UnsupportedOperationException
- if T is not comparable;
-
sort
-
copy
-
iterator
-
lower_bound
Returns an iterator postioned at the item in the vector that is the smallest key less or equal than the given key. This method assumes the vector is sorted in ascending order.- Parameters:
key
- the key for which to find the lower bound- Returns:
- an iterator postioned at the item in the vector that is the smallest key less or equal than the given key.
- Throws:
UnsupportedOperationException
- if T is not comparable
-
lower_bound
Returns an iterator postioned at the item in the vector that is the smallest key less or equal than the given key. This method assumes the vector is sorted in ascending order.- Parameters:
key
- the key for which to find the lower bound- Returns:
- an iterator postioned at the item in the vector that is the smallest key less or equal than the given key.
-
upper_bound
Returns an iterator postioned at the item in the vector that is the smallest key less than the given key. This method assumes the vector is sorted in ascending order.- Parameters:
key
- the key for which to find the upper bound- Returns:
- an iterator postioned at the item in the vector that is the smallest key less than the given key.
- Throws:
UnsupportedOperationException
- if T is not comparable
-
upper_bound
Returns an iterator postioned at the item in the vector that is the smallest key less than the given key. This method assumes the vector is sorted in ascending order.- Parameters:
key
- the key for which to find the upper bound- Returns:
- an iterator postioned at the item in the vector that is the smallest key less than the given key.
- Throws:
UnsupportedOperationException
- if T is not comparable
-
merge
-
merge
public static <K> void merge(VectorSTL<K> v1, VectorSTL<K> v2, VectorSTL<K> destination, Comparator<K> comparator) -
resize
-
insert
-
assign
-