Solved

Is there any to use Java's vector like User-type from VB, such as a vector of vectors?

Posted on 2004-10-08
23
260 Views
Last Modified: 2010-03-31

New to Java from VB6

Is there any to use Java's vector like User-type from VB, such as a vector of vectors?

type var1
    string as String
    int1 as Interger
    single1 as single
end type

Anything in Java like this: I looked at multidimentional array but they are restricked to one variable type throughout the array.

I looked at vector method but there is no multi-dimentional version, is there?

Is there such a method as vector of vectors so that I can end up with the VB user-type variable?

Bill
0
Comment
Question by:Hiddenattractor
  • 8
  • 8
  • 4
23 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 63 total points
ID: 12265253
Vector main=new Vector();

Vector integers=new Vector();
integers.add(new Integer(10));
integers.add(new Integer(100));
integers.add(new Integer(1000));


main.add(integers);

Vector strings=new Vector();

strings.add("Hello");
strings.add("hi");
main.add(strings);

Are u looking for some thing like this??
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12265267
Or are u expecting something like this??

class UserClass
{
      int i=100;
      String s="Hello";
      Double d=10.0;  
       UserClass(int i,String s,Double d)
       {
                this.i=i;
                this.s=s;
                this.d=d;
        }
}

Vector vect=new Vector();

vect.add(new UserClass(10,"Hello",9.0));
vect.add(new UserClass(100,"Hi",99.99));
0
 
LVL 16

Assisted Solution

by:krakatoa
krakatoa earned 62 total points
ID: 12265446
Like SK illustrated, you are talking about a class here, which is Java's fundamental unit. You'd need to simmply build a class to match your VB UDT, and that class can then be treated like a Java object, and put inside a Vector, and that Vector itself put inside oher vectors and so on if needed.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12265800
May I know why you have accespted krakatoa's answer as he/she also supporting my idea??

0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12277554
Venabili:

It seems often as soon as I get involved in a question, some problem arises (reason why I don't get involved so often, actually).

I thought this -as you've said many times to me yourself - is not "about points"? Maybe the questioner (ho I am sure will answer for himself) just wants an explanation in plain English, rather than code? I would, personally.

But I don't think it's really ok for sudhakar to "put pressure" on the questioner (for which you have reprimanded *me* several times), to try to get points. There are plenty of times when I dont get points for questions that I "answered" first. Do we relaly need to go through this painful rigamarole again???
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12278195
>>just wants an explanation in plain English, rather than code?
Friend, You just reframmed  my code in english, I believe.

>>But I don't think it's really ok for sudhakar to "put pressure" on the questioned
In such case I can't say thing to you friend.

>>There are plenty of times when I dont get points for questions that I "answered" first
Friend, this happens even to me, ofcouse to other experts also I believe. But how many times one should loose their points??.

>>Do we relaly need to go through this painful rigamarole again???
Friend, Sincerely I want to say, If this is not for points, you don't post that comments.(Honestly this applies even  me too )

Although all friends tries to help more or less to the questioners - Our friend's  first intentions it get the points only - Because all of us want to prove ourselves and this is True as per my belief.

And coming to reopening the question and accepting my question/splitting the points - I leave this to Hiddenattractor's decision.


Regards
Sudhakar
0
 
LVL 20

Expert Comment

by:Venabili
ID: 12278263
Guys,

CALM DOWN!

krakatoa,

O proposed split. Because you both did great work here:)
I had not reopen and I will not unless the Asker asks me - I am just explaining what should be done. But these are their points ;)

But - you  both put a lot of work here and as I said both answers are great...

>>reason why I don't get involved so often, actually
And we miss you  :)

sudhakar ,

OK... I missed your comment.:( No pressure in the future question - post for me in my thread and let me do the explanations and so on:) Better than annoying the fellow-experts ;)

Venabili
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12279397
Vanabili,

OK..

I will do not put pressure on questioners, if I face similar problems in future participations.

Regards
Sudhakar

0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12279811
I just feel that it's best to roll with the punches as they say. I agree with Venabili that there has to be some usual way of awarding points, but at the end of the day it's the questioner who is the customer, and unless an answer is awarded which is completely wrong, then, in the end, things even themselves out in the long run, and experts like sudhakar will pick up more points than someone like me, and I don't have a problem with that. ;)
0
 
LVL 20

Expert Comment

by:Venabili
ID: 12281273
Question reopened per request in feedback

krakatoa,

No personal isues. The idea is not who takes the points but when someone click on "View Solution" to see the solution(code+explanation in our case)

Hiddenattractor,
Read the help page. They are written for this - to explain to the users how the site works and what should be cloicked when:)

Venabili
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:krakatoa
ID: 12281348
That's ok. It just means that if I do happen to have a good answer, I will think twice about offering it, as this is again  a waste of time.
0
 
LVL 20

Expert Comment

by:Venabili
ID: 12281388
Are you claiming that only you deserve points here?
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12281401
:( I'm saying the questioner made the choice and now his decision has been questioned - and that's all I have to say.
0
 
LVL 20

Expert Comment

by:Venabili
ID: 12284682
krakatoa,

Sometimes the Askers has no idea that they can split points. Does this mean that we should leave the things as they are?
And this particular asker said that he had made mistake...

If i see something like this happen- i react - no matter which are the experts... That is what I am supposed to do

Venabili
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12542875
Yeah ... I've got something to add venabili:

The questioner asked specifically about "vector(s) of vectors". I was the first and only one to deal with that specific side of the question, so I don't wonder that all the points were originally awarded to me - which I think is where they belong.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12542921
>> I was the first and only one to deal with that specific side of the question

My first comment already gave that answer vector integers and strings where integers and strings are individual vectors

regards
sudhakar
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12542932
Obviously if the asker is not familiar with Java, it isn't very likely that he'd understand your code, if he is asking the question in the first place is it? Your code doesn't explain what's going on unless you are already familiar with Java.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12542934
rephrasing
My first comment already gave that answer main vector holds  integers and strings where integers and strings are individual vectors


And my second comment says main vector holds the individual class units where class holds the integer, string and other data varaibles.

conceptually speaking class can also be treated as vector as it can hold multiple objects. Only thing that i may /may not do is working like Java Vector class


Hence, my both comments are correct as per the question


Regards
Sudhakar
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12542953
>>Your code doesn't explain what's going on unless you are already familiar with Java.


In his  first comments only questioner said that he is looking at Vector but thinking of multi dimensional array. So there is no question to be araised that he don't know abt that class

Regards
Sudhakar
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12543245
:D
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 79
Cipher Configuration on Apache HTTPD 4 53
servlet doXXX methods 3 37
HTTPSessionBindingListernter not configured in deployment descriptor 2 38
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now