Vector example in Java
Vector implements a dynamic array. It is similar to ArrayList, but with two differences: Vector is synchronized, and it contains many legacy methods that are not part of the collec
Read tutorialTHE TUTORIAL LIBRARY
Vector implements a dynamic array. It is similar to ArrayList, but with two differences: Vector is synchronized, and it contains many legacy methods that are not part of the collec
Read tutorialJava 2 added a new class to java.util called Arrays. This class provides various methods that are useful when working with arrays. Although these methods technically aren't part of
Read tutorialThe following is an example that demonstrates the power of a custom comparator. It implements the compare() method so that it operates in reverse of normal. Thus, it causes a tree
Read tutorialThe TreeMap class implements the Map interface by using a tree. A TreeMap provides an efficient means of storing key/value pairs in sorted order, and allows rapid retrieval. You sh
Read tutorialThe HashMap class uses a hash table to implement the Map interface. This allows the execution time of basic operations, such as get() and put(), to remain constant even for large s
Read tutorialBefore you can access a collection through an iterator, you must obtain one. Each of thecollection classes provides an iterator() method that returns an iterator to the start of th
Read tutorialTreeSet provides an implementation of the Set interface that uses a tree for storage. Objects are stored in sorted, ascending order. Access and retrieval times are quite fast, whic
Read tutorialA reference is an alias; when you create a reference, you initialize it with the name of another object, the target. From that moment on, the reference acts as an alternative name
Read tutorialYou can use the keyword const for pointers before the type, after the type, or in both places. For example, all of the following are legal declarations:
Read tutorialOne source of bugs that are nasty and difficult to find is stray pointers. A stray pointer is created when you call delete on a pointer--thereby freeing the memory that it points t
Read tutorialEvery class member function has a hidden parameter: the this pointer. this points to the individual object. Therefore, in each call to GetAge() or SetAge(), the this pointer for th
Read tutorialNormally you can access data members and functions by using the dot (.) operator for Cat objects created locally. To access the Cat object on the free store, you must dereference t
Read tutorialOne example today. A better developer tomorrow.