revert to more sophisticated data structures references are faster java has an advantage over some languages in the speed with which objects can be manipulatedbecausein most data structuresjava stores only referencesnot actual objects therefore most algorithms will run faster than in languages where actual objects occupy space in data structure in analyzing the algorithms it' not the caseas when objects themselves are storedthat the time to "movean object depends on the size of the object because only reference is movedit doesn' matter how large the object is of course in other languagessuch as ++pointers to objects can be stored instead of the objects themselvesthis has the same effect as using referencesbut the syntax is more complicated libraries libraries of data structures are available commercially in all major programming languages languages themselves may have some structures built in javafor exampleincludes vectorstackand hashtable classes +includes the standard template library (stl)which contains classes for many data structures and algorithms using commercial library may eliminate or at least reduce the programming necessary to create the data structures described in this book when that' the caseusing complex structure such as balanced treeor delicate algorithm such as quicksortbecomes more attractive possibility howeveryou must ensure that the class can be adapted to your particular situation arrays in many situations the array is the first kind of structure you should consider when storing and manipulating data arrays are useful when the amount of data is reasonably small the amount of data is predictable in advance if you have plenty of memoryyou can relax the second conditionjust make the array big enough to handle any foreseeable influx of data if insertion speed is importantuse an unordered array if search speed is importantuse an ordered array with binary search deletion is always slow in arrays because an average of half the items must be moved to fill in the newly vacated cell traversal is fast in an ordered array but not supported in an unordered array vectorssuch as the vector class supplied with javaare arrays that expand themselves when they become too full vectors may work when the amount of data isn' known in advance howeverthere may periodically be significant pause while they enlarge themselves by copying the old data into the new space linked lists consider linked list whenever the amount of data to be stored cannot be predicted in advance or when data will frequently be inserted and deleted the linked list obtains whatever storage it needs as new items are addedso it can expand to fill all of available memoryand there is no need to fill "holesduring deletionas there is in arrays