[Beds] Java Question

Darren Parkinson darren.parkinson at gmail.com
Tue Dec 6 14:27:09 GMT 2005


I think in this instance you'd be best to utilise a Vector as you can get
this to increase by a specified increment when it needs to grow during
runtime which you obviously can't do with your array, using the Constructor
version Vector(int *size*, int *incr*).

Apparently, you can still then assign this to an Array for more advanced
manipulation via:

int count = yourVector.size();
String[] yourArray = new String[count];
yourVector.copyInto(yourArray);

I'd like to say I made this all up myself, but I got some of this
information from http://www.devx.com/tips/Tip/13044

I'm also wondering if there is a newer way to do this since my Java
knowledge is now quite old...

Hope this helps...

Regards,
Darren.

On 12/6/05, Stephen Elliott <techweb at ntlworld.com> wrote:
>
> Hi there,
>
>
> I have a quick Java question I'd like to run past any Java Gurus out
> there.
> I am writing a multi-thread chat server programming using RMI and want to
> store all the
> messages users send to each other in an array. The purpose being, when
> someone new joins the chat room they will receive all previous messages
> users have sent to one another. So far all I can do is store a predefined
> amount e.g. 100. I have achieved this by creating a string array with 100
> elements. What I would like to do is be able to store an infinite number
> of
> messages but is it possible to create an array with an infinite number of
> elements.
>
> I hope what I have said makes sense, this is as you've probably guessed an
> assignment we have been given at University. I have asked my lecturer and
> he
> says this is beyond the scope of the course but to me it seems foolhardy
> to
> write a program that will crash once 100 messages have been relayed.
>
> Many Thanks
> Steve...
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.13.12/192 - Release Date:
> 05/12/2005
>
>
> _______________________________________________
> Beds mailing list
> Beds at mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/beds
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/beds/attachments/20051206/4870df7c/attachment.html


More information about the Beds mailing list