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
259 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresSpecial  challenge 13 40
count11 challenge 6 47
where is session ID cache stored 1 39
topping3 challenge 14 49
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

707 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

15 Experts available now in Live!

Get 1:1 Help Now