On 24 Jul 2001 10:30:54 +0200, Jose Antonio Lamas wrote:
> Hi,
>
> I have used Array, Vector and Hashtable to keep the table's data model, but
> I have a question/comment.
>
> Which is the best alternative? The two objetives are speed and ease of use.
>
> I think:
>
> -- PROS--
> Array is fast and easy.
> Vector has a variable size.
> Hashtable is fast (is Array faster than Hashtable?).
>
> -- CONS --
> Array has a fixed length.
> Vector is not very fast (because of castings) and not so easy.
> Hashtable is not so easy as Array.
Firstly, stop using the JDK 1.1 containers and move to Collections -
Vector -> ArrayList, Hashtable -> HashMap/HashSet.
A vector is a thin wrapper around an array (to resize it as needed). If
you need raw speed, use an array but Vectors (and ArrayLists, which are
better) are very handy as they can resize and can be used as general
Lists. Casting isn't that slow really, and all generic containers (ones
which store Objects) will require casting.
Hash tables are not ordered however, which is not what you want for a
table model. I suggest you start looking at java.util.List and see what
subclasses are available - I reccomment ArrayList.
Ross
--
Ross Burton Software Engineer
OneEighty Software Ltd Tel: +44 20 8680 8712
Cygnet House Fax: +44 20 8680 8453
12-14 Sydenham Road [EMAIL PROTECTED]
Croydon, Surrey CR9 2ET, UK http://www.180sw.com./
====================================================================
Under the Regulation of Investigatory Powers (RIP) Act 2000 together
with any and all Regulations in force pursuant to the Act OneEighty
Software Ltd reserves the right to monitor any or all incoming or
outgoing communications as provided for under the Act
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing